Nodemon restarts inconsistently after file changes: chokidar default vs --legacy watcher behavior
0 reputation · 09 Dec 2020, 06:13 UTC
Watcher choice and restart timing
I am configuring nodemon for a development workflow and need to understand one unresolved point before locking in our setup: since nodemon v1.0 switched its default file watcher from Node's native fs.watch to chokidar, restart timing and resource usage reportedly differ from the older implementation. The --legacy flag is documented as a way to force the previous fs.watch behavior.
My constraints: the team works across macOS, Windows, and Linux machines, plus Docker containers with mounted volumes, so watcher behavior may not be uniform. I also want to avoid depending on --legacy if it may be removed in a future major release. I have not yet observed a concrete failure; this is a design decision about which watcher to standardize on and how to verify it behaves correctly everywhere.
Specifically:
- What observable differences in restart timing or missed-change behavior should I expect between the chokidar default and --legacy mode, particularly on case-insensitive filesystems and bind-mounted Docker volumes?
- Is there a documented, deterministic way to verify which watcher a given nodemon version is actually using at runtime?
- Given the possibility of --legacy being deprecated, is relying on the chokidar default with configuration (e.g., delay or polling options) the recommended long-term path?