--watch


稳定性: 1 - 实验

以监视模式启动 Node.js。 在监视模式下,监视文件中的更改会导致 Node.js 进程重新启动。 默认情况下,监视模式将监视入口点和任何必需或导入的模块。 使用 --watch-path 指定要监视的路径。

此标志不能与 --check--eval--interactive 或 REPL 组合。

$ node --watch index.js

Stability: 1 - Experimental

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.

This flag cannot be combined with --check, --eval, --interactive, or the REPL.

$ node --watch index.js