--watch-path
以监视模式启动 Node.js,并指定要监视的路径。 在监视模式下,被监视路径的更改会导致 Node.js 进程重新启动。 这将关闭对所需或导入模块的监视,即使与 --watch 结合使用也一样。
【Starts Node.js in watch mode and specifies what paths to watch.
When in watch mode, changes in the watched paths cause the Node.js process to
restart.
This will turn off watching of required or imported modules, even when used in
combination with --watch.】
此标志不能与 --check、--eval、--interactive 或 REPL 一起使用。
【This flag cannot be combined with
--check, --eval, --interactive, or the REPL.】
$ node --watch-path=./src --watch-path=./tests index.js 此选项仅在 macOS 和 Windows 上受支持。
在不支持该选项的平台上使用时,将抛出 ERR_FEATURE_UNAVAILABLE_ON_PLATFORM 异常。
【This option is only supported on macOS and Windows.
An ERR_FEATURE_UNAVAILABLE_ON_PLATFORM exception will be thrown
when the option is used on a platform that does not support it.】