Restart node process when file is saved

June 10, 2024

With the --watch flag you can restart the Node process when a file is saved. This only works with JavaScript files, if you need to do this with TypeScript you need to use Nodemon .

node --watch index.js

The --watch flag is stable in Node v22.0.0 or later.

Read Node --watch docs for more information.