Back to Developer Roadmap

--watch

src/data/roadmaps/nodejs/content/--watch@812bVEzxwTsYzLG_PmLqN.md

4.0761 B
Original Source

--watch

The --watch flag in Node.js is a powerful feature introduced in Node.js version 19 that enables automatic reloading of your Node.js application whenever changes are detected in the specified files.

Here's How it works:

  • You run your Node.js script with the --watch flag: $ node --watch your_script.js
  • Node.js starts watching the specified file (or directory) for changes.
  • Whenever a change is detected, Node.js automatically restarts the script

Visit the following resources to learn more: