Please provide us with the following information:
- OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Windows 10- Versions. Please run
ng --version. If there's nothing outputted, please run
in a Terminal:node --versionand paste the result here:
angular-cli: 1.0.0-beta.11-webpack
node: 4.4.4
os: win32 x64- Repro steps. Was this an app that wasn't created using the CLI? What change did you
do on your code? etc.
ng serve --prod- The log given by the failure. Normally this include a stack trace and some
more information.
N/A- Mention any other details that might be useful.
Why is sockjs included in the production build? I can see a websocket connection made.
@StevePavlin Thanks for inquiring. SockJS is one of the pieces that powers webpack-dev-server. You may have also noticed that when you run ng serve in the new webpack branch, that you do not have anything produced in the /dist folder.
This is because webpack-dev-server uses memory-fs, an in memory filesystem to produce bundles virtually and then served to the dev server.
SockJS's purpose is to send websocket based messages to the dev-server to reload whenever changes are made to your project (triggering an incremental build).
You can see more details here.
@TheLarkInn That makes sense, but is SockJS needed for production builds, when users probably won't be using the webpack-dev-server?
I'm trying to serve my application with http-server, and I receive a constant stream of 404 errors like
"GET /sockjs-node/info?t=1470676240769" Error (404): "Not found"
It seems like SockJS shouldn't be used in this case.
Nope, SockJS (AKA webpack-dev-server) is only used for ng serve. If you run ng build you will not find any of these modules inside of your bundled src code.
We wanted to give people the option of still running a dev server, and viewing production results.
If you wanted to verify this you can run: ng build --prod and then run an http-server on the dist folder to see that the results will not include any sockjs code.
@TheLarkInn whoops! I think I accidentally ran the http-server on a development build instead of production. Thanks!
All cleared up, thanks!
omg..this's why I always got complier error when I import sockjs..
i used remote dev machine and excute ng serve --host 0.0.0.0, i test in my local system , i got sockjs error, how to fix it?
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
@StevePavlin Thanks for inquiring. SockJS is one of the pieces that powers
webpack-dev-server. You may have also noticed that when you runng servein the new webpack branch, that you do not have anything produced in the/distfolder.This is because webpack-dev-server uses
memory-fs, an in memory filesystem to produce bundles virtually and then served to the dev server.SockJS's purpose is to send websocket based messages to the dev-server to reload whenever changes are made to your project (triggering an incremental build).
You can see more details here.