--watch
稳定性: 1 - 实验性
以监视模式启动 Node.js。
在监视模式下,被监视的文件发生更改会导致 Node.js 进程重启。
默认情况下,监视模式会监视入口点以及所有所需或导入的模块。
使用 --watch-path 来指定要监视的路径。
【Starts Node.js in watch mode.
When in watch mode, changes in the watched files cause the Node.js process to
restart.
By default, watch mode will watch the entry point
and any required or imported module.
Use --watch-path to specify what paths to watch.】
此标志不能与 --check、--eval、--interactive 或 REPL 一起使用。
【This flag cannot be combined with
--check, --eval, --interactive, or the REPL.】
$ node --watch index.js