Skip to content

Commit

Permalink
fix(cli): inspect flag is deprecated
Browse files Browse the repository at this point in the history
This commit effectively removes the --inspect flag from the CLI help and better inform on the deprecation.
  • Loading branch information
vvo committed Mar 4, 2020
1 parent 8390a47 commit ad2d1f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
9 changes: 4 additions & 5 deletions docs/api-reference/cli.md
Expand Up @@ -25,17 +25,16 @@ Available commands

Options
--version, -v Version number
--inspect Enable the Node.js inspector
--help, -h Displays this message

For more information run a command with the --help flag
$ next build --help
```

You can pass any node arguments to `next` commands:
You can pass any [node arguments](https://nodejs.org/api/cli.html#cli_node_options_options) to `next` commands:

```bash
NODE_OPTIONS="--throw-deprecation" next
NODE_OPTIONS="-r esm" next
NODE_OPTIONS="--inspect" next
NODE_OPTIONS='--throw-deprecation' next
NODE_OPTIONS='-r esm' next
NODE_OPTIONS='--inspect' next
```
3 changes: 1 addition & 2 deletions packages/next/bin/next.ts
Expand Up @@ -63,7 +63,6 @@ if (!foundCommand && args['--help']) {
Options
--version, -v Version number
--inspect Enable the Node.js inspector
--help, -h Displays this message
For more information run a command with the --help flag
Expand All @@ -77,7 +76,7 @@ const forwardedArgs = foundCommand ? args._.slice(1) : args._

if (args['--inspect'])
throw new Error(
`Use env variable NODE_OPTIONS instead: NODE_OPTIONS="--inspect" next ${command}`
`deprecated: --inspect flag is deprecated. Use env variable NODE_OPTIONS instead: NODE_OPTIONS='--inspect' next ${command}`
)

// Make sure the `next <subcommand> --help` case is covered
Expand Down

0 comments on commit ad2d1f5

Please sign in to comment.