Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
9a7ebb1c
Unverified
Commit
9a7ebb1c
authored
Dec 17, 2018
by
Tim Neutkens
Committed by
GitHub
Dec 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove node-args in favor of NODE_OPTIONS environment variable (#5910)
parent
581e193a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
22 deletions
+13
-22
README.md
packages/next/README.md
+9
-5
next.ts
packages/next/bin/next.ts
+3
-9
index.test.js
test/integration/cli/test/index.test.js
+1
-8
No files found.
packages/next/README.md
View file @
9a7ebb1c
...
@@ -1340,13 +1340,17 @@ module.exports = {
...
@@ -1340,13 +1340,17 @@ module.exports = {
#### Configuring next process script
#### Configuring next process script
You can pass any node arguments to
`next`
cli command.
You can pass any node arguments to
`next`
CLI command.
```
bash
```
bash
next --node-args="--throw-deprecation"
NODE_OPTIONS
=
"--throw-deprecation"
next
next start --node-args="--inspect"
NODE_OPTIONS
=
"-r esm"
next
next build --node-args="-r esm"
```
`--inspect`
is a special case since it binds to a port and can't double-bind to the child process the
`next`
CLI creates.
```
next start --inspect
```
```
### Customizing webpack config
### Customizing webpack config
...
...
packages/next/bin/next.ts
View file @
9a7ebb1c
...
@@ -24,7 +24,6 @@ const args = arg({
...
@@ -24,7 +24,6 @@ const args = arg({
// Types
// Types
'--version'
:
Boolean
,
'--version'
:
Boolean
,
'--help'
:
Boolean
,
'--help'
:
Boolean
,
'--node-args'
:
String
,
'--inspect'
:
Boolean
,
'--inspect'
:
Boolean
,
// Aliases
// Aliases
...
@@ -55,7 +54,7 @@ if (!foundCommand && args['--help']) {
...
@@ -55,7 +54,7 @@ if (!foundCommand && args['--help']) {
Options
Options
--version, -p Version number
--version, -p Version number
--
node-args Node arguments applied to the process
--
inspect Enable the Node.js inspector
--help, -h Displays this message
--help, -h Displays this message
For more information run a command with the --help flag
For more information run a command with the --help flag
...
@@ -64,17 +63,12 @@ if (!foundCommand && args['--help']) {
...
@@ -64,17 +63,12 @@ if (!foundCommand && args['--help']) {
process
.
exit
(
0
)
process
.
exit
(
0
)
}
}
// Add support for `--node-args` to send Node.js arguments to the spawned process
const
nodeArguments
:
string
[]
=
[]
const
nodeArguments
=
args
[
'--node-args'
]
&&
args
[
'--node-args'
]
!==
''
?
args
[
'--node-args'
].
split
(
' '
)
:
[]
if
(
args
[
'--inspect'
])
{
if
(
args
[
'--inspect'
])
{
console
.
log
(
'
The `--inspect` option is deprecated in favor of `--node-args`
'
)
console
.
log
(
'
Passing "--inspect" to Node.js
'
)
nodeArguments
.
push
(
'--inspect'
)
nodeArguments
.
push
(
'--inspect'
)
}
}
if
(
nodeArguments
.
length
>
0
)
{
console
.
log
(
`Passing arguments to Node.js: "
${
nodeArguments
.
join
(
' '
)}
"`
)
}
const
command
=
foundCommand
||
defaultCommand
const
command
=
foundCommand
||
defaultCommand
const
forwardedArgs
=
args
.
_
.
filter
(
arg
=>
arg
!==
command
)
const
forwardedArgs
=
args
.
_
.
filter
(
arg
=>
arg
!==
command
)
...
...
test/integration/cli/test/index.test.js
View file @
9a7ebb1c
...
@@ -45,14 +45,7 @@ describe('CLI Usage', () => {
...
@@ -45,14 +45,7 @@ describe('CLI Usage', () => {
const
output
=
await
runNextCommand
([
'build'
,
dir
,
'--inspect'
],
{
const
output
=
await
runNextCommand
([
'build'
,
dir
,
'--inspect'
],
{
stdout
:
true
stdout
:
true
})
})
expect
(
output
.
stdout
).
toMatch
(
/The `--inspect` option is deprecated/
)
expect
(
output
.
stdout
).
toMatch
(
/Passing "--inspect" to Node
\.
js/
)
})
test
(
'--node-args'
,
async
()
=>
{
const
output
=
await
runNextCommand
([
'build'
,
dir
,
'--node-args=--inspect'
],
{
stdout
:
true
})
expect
(
output
.
stdout
).
toMatch
(
/Passing arguments to Node
\.
js: "--inspect"/
)
})
})
})
})
describe
(
'build'
,
()
=>
{
describe
(
'build'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment