Skip to content

Conversation

wo-o29
Copy link
Contributor

@wo-o29 wo-o29 commented Aug 27, 2025

Description

This PR adds a reference link in the documentation for the server.watcher option regarding its behavior when set to null.
The documentation states:
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.
This PR adds a link to the server.watcher API for further details.

What was changed

  • Added a link to the server.watcher API documentation in the relevant sentence about its behavior when set to null.

Why this change is necessary

  • Improves usability and clarity by providing direct access to the detailed API documentation.
  • Helps users understand the behavior and use of server.watcher more effectively.

@@ -256,7 +256,7 @@ File system watcher options to pass on to [chokidar](https://github.com/paulmill

The Vite server watcher watches the `root` and skips the `.git/`, `node_modules/`, `test-results/`, and Vite's `cacheDir` and `build.outDir` directories by default. When updating a watched file, Vite will apply HMR and update the page only if needed.

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.
If set to `null`, no files will be watched. `server.watch` will provide a compatible event emitter, but calling `add` or `unwatch` will have no effect.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current documentation is correct since this is ViteDevServer.watcher https://vite.dev/guide/api-javascript.html#vitedevserver. Perhaps we can add a link instead.

Suggested change
If set to `null`, no files will be watched. `server.watch` will provide a compatible event emitter, but calling `add` or `unwatch` will have no effect.
If set to `null`, no files will be watched. [`server.watcher`](/guide/api-javascript.html#vitedevserver) will provide a compatible event emitter, but calling `add` or `unwatch` will have no effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I checked! I will fix it by adding the link :)

@wo-o29 wo-o29 changed the title docs(server): fix option name from 'server.watcher' to 'server.watch' docs(server): add reference link for 'server.watcher' null behavior Aug 27, 2025
@hi-ogawa hi-ogawa merged commit 7f6af9d into vitejs:main Aug 27, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants