-
-
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
Use fs.watch instead of chokidar if Node.js >=v19.1 #12495
Comments
How is Generally I'm for trying it because it removes the pain that is |
No longer a problem.
Cannot replicate.
True.
True.
No longer true, as of Node.js v19.1
No longer true, as of Node.js v19.1 |
Can and should be worked around via debounce or better, a shared interval that batches events together.
Probably does not matter in context of vite's usage. |
Indeed. |
@silverwind This might be useful vercel/turborepo#986 (comment) |
This is a common misconception among Node users. NodeJS does not fire multiple events for a single change, it is the editor updates the file multiple times. Checkout the link for details. If fs watch is not enough, best alternative would be parcel watcher which powers vscode: |
Parcel watcher implements the same backends that Turbowatch does:
|
Closing this to continue the conversation at #13593. We have also discussed using |
Describe the bug
File changes are not being detected when multiple instances of chokidar are running in the directory.
When using Turbowatch (which used to default to chokidar) and Vite together, Vite's HMR would just stop working.
Change watching method to polling fixes the issue, but mixes CPU go brrrrrrrr.
As far as I can tell, it is due to this issue paulmillr/chokidar#1240
For what it is worth, Turbowatch was also updated to use the suggested logic.
gajus/turbowatch#22
Theoretically Vite could just use Turbowatch to implement watching.
Reproduction
N/A
Steps to reproduce
N/A
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: