webpack: [Webpack 5] Error: EMFILE, too many open files in watch mode
Bug report
What is the current behavior?
When I run webpack 5 in watch mode(or webpack-dev-server), webpack compiles my project successfully, but then I start getting the error Error: EMFILE, too many open files in watch mode
. The terminal tab gets stuck and I am not able to close the process by using (ctrl
+c
). I have to close the terminal tab
If the current behavior is a bug, please provide the steps to reproduce. I investigated and found that the bug is due to this plugin WatchMissingNodeModulesPlugin. It used to work correctly with Webpack 4. On removing this plugin, everything works correctly. I think the issue is when webpack tries to watch large number of files
What is the expected behavior? Webpack’s watch should not fail with the above mentioned error.
Other relevant information: webpack version: 5.0.0-beta.22 Node.js version: v12.17.0 Operating System: MacOS 10.15.6
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (8 by maintainers)
This issue is reproducible. I have created a minimum reproducible example here.
Steps to setup:
yarn
yarn start
Expected output =>
["extract","parse","stringify","parseUrl","stringifyUrl"]
Steps to reproduce:
node_modules/query-string/index.js
fileexports.abcd = "test"
(or anything else, while the dev server is still running).Add this line(
cache.managedPaths = []
) inwebpack.config.js
(or just uncomment the cache block), and repeat the above steps. The output in the browser changes