diff --git a/config/server-options.md b/config/server-options.md index 9d1adefb..cd9b809b 100644 --- a/config/server-options.md +++ b/config/server-options.md @@ -176,7 +176,7 @@ The error that appears in the Browser when the fallback happens can be ignored. ## server.watch -- **Type:** `object` +- **Type:** `object | null` File system watcher options to pass on to [chokidar](https://github.com/paulmillr/chokidar#api). @@ -197,6 +197,8 @@ export default defineConfig({ }) ``` +If set to `null`, no files will be watched. `server.watcher` will provide a compatible event emitter, but calling `add` or `unwatch` will have no effect. + ::: warning Using Vite on Windows Subsystem for Linux (WSL) 2 When running Vite on WSL2, file system watching does not work when a file is edited by Windows applications (non-WSL2 process). This is due to [a WSL2 limitation](https://github.com/microsoft/WSL/issues/4739). This also applies to running on Docker with a WSL2 backend. diff --git a/guide/api-javascript.md b/guide/api-javascript.md index c320d537..b51f5f4a 100644 --- a/guide/api-javascript.md +++ b/guide/api-javascript.md @@ -75,7 +75,8 @@ interface ViteDevServer { */ httpServer: http.Server | null /** - * Chokidar watcher instance. + * Chokidar watcher instance. If `config.server.watch` is set to `null`, + * returns a noop event emitter. * https://github.com/paulmillr/chokidar#api */ watcher: FSWatcher