Skip to content

Commit fbfad21

Browse files
bluwyMadLittleMods
andauthored
docs: update server.watch info (#14469)
Co-authored-by: Eric Eastwood <[email protected]>
1 parent 031aaf4 commit fbfad21

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

docs/config/server-options.md

+7-16
Original file line numberDiff line numberDiff line change
@@ -180,25 +180,16 @@ The error that appears in the Browser when the fallback happens can be ignored.
180180

181181
File system watcher options to pass on to [chokidar](https://github.com/paulmillr/chokidar#api).
182182

183-
The Vite server watcher skips `.git/` and `node_modules/` directories by default. If you want to watch a package inside `node_modules/`, you can pass a negated glob pattern to `server.watch.ignored`. That is:
184-
185-
```js
186-
export default defineConfig({
187-
server: {
188-
watch: {
189-
ignored: ['!**/node_modules/your-package-name/**'],
190-
},
191-
},
192-
// The watched package must be excluded from optimization,
193-
// so that it can appear in the dependency graph and trigger hot reload.
194-
optimizeDeps: {
195-
exclude: ['your-package-name'],
196-
},
197-
})
198-
```
183+
The Vite server watcher watches the `root` and skips the `.git/` and `node_modules/` directories by default. When updating a watched file, Vite will apply HMR and update the page only if needed.
199184

200185
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.
201186

187+
::: warning Watching files in `node_modules`
188+
189+
It's currently not possible to watch files and packages in `node_modules`. For further progress and workarounds, you can follow [issue #8619](https://github.com/vitejs/vite/issues/8619).
190+
191+
:::
192+
202193
::: warning Using Vite on Windows Subsystem for Linux (WSL) 2
203194

204195
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.

0 commit comments

Comments
 (0)