Skip to content

Commit 62056d4

Browse files
juanibebnb
authored andcommitted
doc: clarify behavior of --watch-path and --watch flags
Fixes: #58113 PR-URL: #58136 Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Co-authored-by: Tierney Cyren <accounts@bnb.im>
1 parent 308f4ca commit 62056d4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

doc/api/cli.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3076,6 +3076,10 @@ Use `--watch-path` to specify what paths to watch.
30763076
This flag cannot be combined with
30773077
`--check`, `--eval`, `--interactive`, or the REPL.
30783078

3079+
Note: The `--watch` flag requires a file path as an argument and is incompatible
3080+
with `--run` or inline script input, as `--run` takes precedence and ignores watch
3081+
mode. If no file is provided, Node.js will exit with status code `9`.
3082+
30793083
```bash
30803084
node --watch index.js
30813085
```
@@ -3103,6 +3107,9 @@ combination with `--watch`.
31033107
This flag cannot be combined with
31043108
`--check`, `--eval`, `--interactive`, `--test`, or the REPL.
31053109

3110+
Note: Using `--watch-path` implicitly enables `--watch`, which requires a file path
3111+
and is incompatible with `--run`, as `--run` takes precedence and ignores watch mode.
3112+
31063113
```bash
31073114
node --watch-path=./src --watch-path=./tests index.js
31083115
```

0 commit comments

Comments
 (0)