node --watch-path=src/ script.js

Category: Node.js & npm/yarn

node --watch-path=src/ script.js

Watch an entire directory for changes and restart the script when any file changes (Node 19+)

Watches an entire directory for changes and restarts the entry script when any file inside changes (Node 19+).
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.