Q60: How does Node.js native watch mode work and how does it replace Nodemon?

Node.js v18.11+ introduced a native file watching flag --watch. When started with node --watch app.js, Node.js monitors imported dependency files and automatically restarts the process whenever changes are saved, removing the need for external CLI dependencies like nodemon or pm2-dev during local development.

Key Takeaways
  • Native --watch flag monitors imported application files for changes automatically.
  • Eliminates external development dependencies like Nodemon.
Knowledge Check

Which built-in Node.js CLI flag enables native automatic process restarts on file changes?