Skip to content

Use fs.watch instead of chokidar if Node.js >=v19.1 #12495

@gajus

Description

@gajus

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

N/A

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions