-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runtime error when node.global
is set to false.
#1147
Comments
`webpack-dev-server` bundles `sockjs-client` from source. `sockjs-client` sources assume a node environment however, and will fail to run if `global` is not available. By bundling `sockjs-client` from source, the node environment requirement from `sockjs-client` will also be required of the app being served and thus it is not possible to have `node.global = false` in the user app being bundled. This fix uses the built `sockjs-client` instead of the sources. Fix webpack#1147
Holy hiding edge, batman! I award you 10 points for finding that obscure error. I'd say that first and foremost, that should be addressed with the SockJS team, which it looks like you're well on your way to doing. I'm focusing my time on the v3 effort and rollout at the moment. Of which one of the major changes is a move away from SockJS and to native Normally I'd suggest that this be closed, citing the move away from SockJS and the open issue tracking the problem with the SockJS project, but I'm good to leave it open for discussion in the event that another contributor or dev finds and submits a fix. Edit: Ah it seems you've already identified a fix in #1148! |
Thanks for the quick reply @shellscape! I did find a fix but didn't add a test. Will add one now to make sure everything is fine. |
`webpack-dev-server` bundles `sockjs-client` from source. `sockjs-client` sources assume a node environment however, and will fail to run if `global` is not available. By bundling `sockjs-client` from source, the node environment requirement from `sockjs-client` will also be required of the app being served and thus it is not possible to have `node.global = false` in the user app being bundled. This fix uses the built `sockjs-client` instead of the sources. Fix webpack#1147
Done, added test. |
`webpack-dev-server` bundles `sockjs-client` from source. `sockjs-client` sources assume a node environment however, and will fail to run if `global` is not available. By bundling `sockjs-client` from source, the node environment requirement from `sockjs-client` will also be required of the app being served and thus it is not possible to have `node.global = false` in the user app being bundled. This fix uses the built `sockjs-client` instead of the sources. Fix webpack#1147
`webpack-dev-server` bundles `sockjs-client` from source. `sockjs-client` sources assume a node environment however, and will fail to run if `global` is not available. By bundling `sockjs-client` from source, the node environment requirement from `sockjs-client` will also be required of the app being served and thus it is not possible to have `node.global = false` in the user app being bundled. This fix uses the built `sockjs-client` instead of the sources. Fix webpack#1147
`webpack-dev-server` bundles `sockjs-client` from source. `sockjs-client` sources assume a node environment however, and will fail to run if `global` is not available. By bundling `sockjs-client` from source, the node environment requirement from `sockjs-client` will also be required of the app being served and thus it is not possible to have `node.global = false` in the user app being bundled. This fix uses the built `sockjs-client` instead of the sources. Fix webpack#1147
`webpack-dev-server` bundles `sockjs-client` from source. `sockjs-client` sources assume a node environment however, and will fail to run if `global` is not available. By bundling `sockjs-client` from source, the node environment requirement from `sockjs-client` will also be required of the app being served and thus it is not possible to have `node.global = false` in the user app being bundled. This fix uses the built `sockjs-client` instead of the sources. Fix #1147
Code
A reproduction can be found at https://github.com/filipesilva/webpack-dev-server-global.
Expected Behavior
Using
webpack-dev-server
on a browser app withnode.global = false
should not break at runtime.Actual Behavior
webpack-dev-server
has a runtime error:This happens because
webpack-dev-server
is bundlingsockjs-client
from source, andsockjs-client
sources assume a node environment withglobal
available.For more details about how this behaviour is problematic, see angular/angular-cli#5804, mapbox/mapbox-gl-js#4359 (comment) and sockjs/sockjs-client#401 (comment).
For Bugs; How can we reproduce the behavior?
For Features; What is the motivation and/or use-case for the feature?
The text was updated successfully, but these errors were encountered: