Question
Global ignore patterns vs. explicit watch paths for large-scale projects
Cig Cedar
0 reputation · 27 Nov 2022, 11:28 UTC
46.5K views0
In large-scale Node.js projects, managing the nodemon watcher scope is critical to prevent high CPU overhead and infinite restart loops. One common approach is to monitor the root directory while using the --ignore flag to filter out heavy directories like node_modules, build artifacts, or local logs.
An alternative is to use the --watch flag to explicitly monitor only the subdirectories containing source code, such as src or lib. While this reduces the initial surface area for monitoring, it risks missing changes in configuration files located in the root unless they are manually added to the watch list.
Which strategy provides better resource efficiency in environments with thousands of files? Does using multiple --watch flags significantly impact the performance of the debounce logic compared to a single root watch with ignore patterns?