-
- Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
- This is a bug (maybe?)
- This is a modification request
After upgrading to Webpack 5 and webpack-dev-server, my yarn start script take 3 times longer then with Webpack 4. I always returned back to old Webpack. But now I probably found a error which cause such a slowdown.
Probably problematics code:
https://github.com/webpack/webpack-dev-server/blob/master/lib/Server.js#L1017
Expected Behavior
No code is watched (I think same as in Webpack 4 by default)
Actual Behavior
staticOption.watch is actualy an empty object (https://github.com/webpack/webpack-dev-server/blob/master/lib/Server.js#L182) so the condition passes, then webpack-dev-server try to watch the whole project (if you have static directory set to root - even your node-modules are watched). It takes so much time in a larger project.
Workaround Code
devServer: { static: { watch: false } }If you set watch to false, no empty object will be used and your bundle will be much faster (280s -> 80s for me, Webpack v4 120s).