-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Allow disabling watcher altogether #14189
Comments
While working on vitest-dev/vitest#3925 I noticed that sometimes Chokidar can prevent Vitest process from exiting gracefully. By using
When the process was hanging and required forceful exit, it would leave a zombie process on the background. This process started to eat memory really fast and eventually caused out-of-memory from Node's side. This process is shown on the video below. chokidarvitest.mp4After patching Vite by modifying + const watcher = { close: () => {}, on: () => { return watcher }, add: () => {} }
- const watcher = chokidar.watch(
- // config file dependencies and env file might be outside of root
- [root, ...config.configFileDependencies, config.envDir], resolvedWatchOptions); vite/packages/vite/src/node/server/index.ts Lines 362 to 366 in fe1c0b9
|
Description
When calling
createServer
, vite always starts a watcher however it is not always necessary if the consumer just wants to usetransformRequest
API. For example, when running Vitest with--run
or--no-watch
command we don't need a watcher and currently setignored
to['**/*']
to lower the memory consumption. But it seems that it's not enough because Vite adds new files to watch manually (like tsconfig).Suggested solution
Allow passing down
false
as an option toserver.watch
:Instead of starting a chokidar service, Vite will create a noop watcher to not break the API.
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: