Open
Description
Current behavior
When using plugin on macOS, the following error occurs after a dev build, in projects with many files:
No typescript errors found.
node:internal/errors:563
ErrorCaptureStackTrace(err);
^
Error: EMFILE: too many open files, watch
at FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)
Emitted 'error' event on FSWatcher instance at:
at FSWatcher._handleError (/path/to/project/node_modules/chokidar/index.js:539:18)
at NodeFsHandler._boundHandleError (/path/to/project/node_modules/chokidar/handler.js:300:49)
at /path/to/project/node_modules/chokidar/handler.js:149:9
at foreach (/path/to/projectnode_modules/chokidar/handler.js:81:9)
at fsWatchBroadcast (/path/to/project/node_modules/chokidar/handler.js:148:5)
at FSWatcher.<anonymous> (/path/to/project/node_modules/chokidar/handler.js:196:17)
at FSWatcher.emit (node:events:518:28)
at FSWatcher._handle.onchange (node:internal/fs/watchers:213:12) {
errno: -24,
syscall: 'watch',
code: 'EMFILE',
filename: null
}
Node.js v20.11.0
This error seems to be related to the chokidar file watcher used internally, likely due to hitting macOS restrictions on open file descriptors.
🔎 Note: The output (build) directory and node_modules are excluded from the TypeScript and Webpack configs
Expected behavior
There should be no EMFILE: too many open files error during plugin execution on macOS.
Steps to reproduce the issue
- Use the plugin in a project where a directory contains a large number of files.
- Start the dev server on macOS.
Environment
- fork-ts-checker-webpack-plugin: ^9.0.2
- typescript: ^5.6.2
- eslint: ^9.9.1
- webpack: 5.94.0
- os: macOS Sohoma 14.5 (23F79)