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
18f81989
Unverified
Commit
18f81989
authored
Jun 08, 2021
by
JJ Kasper
Committed by
GitHub
Jun 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent node inspect from causing webpack check to fail (#25876)
parent
583b5b9d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
3 deletions
+29
-3
config-utils.ts
packages/next/next-server/server/config-utils.ts
+10
-2
index.test.js
test/integration/config/test/index.test.js
+19
-1
No files found.
packages/next/next-server/server/config-utils.ts
View file @
18f81989
...
@@ -23,13 +23,21 @@ function reasonMessage(reason: CheckReasons) {
...
@@ -23,13 +23,21 @@ function reasonMessage(reason: CheckReasons) {
export
async
function
loadWebpackHook
(
phase
:
string
,
dir
:
string
)
{
export
async
function
loadWebpackHook
(
phase
:
string
,
dir
:
string
)
{
let
useWebpack5
=
true
let
useWebpack5
=
true
let
usesRemovedFlag
=
false
let
usesRemovedFlag
=
false
const
worker
:
any
=
new
Worker
(
const
worker
=
new
Worker
(
path
.
resolve
(
__dirname
,
'./config-utils-worker.js'
),
path
.
resolve
(
__dirname
,
'./config-utils-worker.js'
),
{
{
enableWorkerThreads
:
false
,
enableWorkerThreads
:
false
,
numWorkers
:
1
,
numWorkers
:
1
,
forkOptions
:
{
env
:
{
...
process
.
env
,
NODE_OPTIONS
:
''
,
},
},
}
}
)
)
as
Worker
&
{
shouldLoadWithWebpack5
:
typeof
import
(
'./config-utils-worker'
).
shouldLoadWithWebpack5
}
try
{
try
{
const
result
:
CheckResult
=
await
worker
.
shouldLoadWithWebpack5
(
phase
,
dir
)
const
result
:
CheckResult
=
await
worker
.
shouldLoadWithWebpack5
(
phase
,
dir
)
if
(
result
.
reason
===
'future-flag'
)
{
if
(
result
.
reason
===
'future-flag'
)
{
...
...
test/integration/config/test/index.test.js
View file @
18f81989
...
@@ -19,8 +19,20 @@ jest.setTimeout(1000 * 60 * 5)
...
@@ -19,8 +19,20 @@ jest.setTimeout(1000 * 60 * 5)
describe
(
'Configuration'
,
()
=>
{
describe
(
'Configuration'
,
()
=>
{
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
context
.
output
=
''
const
handleOutput
=
(
msg
)
=>
{
context
.
output
+=
msg
}
context
.
appPort
=
await
findPort
()
context
.
appPort
=
await
findPort
()
context
.
server
=
await
launchApp
(
join
(
__dirname
,
'../'
),
context
.
appPort
)
context
.
server
=
await
launchApp
(
join
(
__dirname
,
'../'
),
context
.
appPort
,
{
env
:
{
NODE_OPTIONS
:
'--inspect'
,
},
onStdout
:
handleOutput
,
onStderr
:
handleOutput
,
})
// pre-build all pages at the start
// pre-build all pages at the start
await
Promise
.
all
([
await
Promise
.
all
([
...
@@ -40,6 +52,12 @@ describe('Configuration', () => {
...
@@ -40,6 +52,12 @@ describe('Configuration', () => {
return
cheerio
.
load
(
html
)
return
cheerio
.
load
(
html
)
}
}
it
(
'should log webpack version correctly'
,
async
()
=>
{
expect
(
context
.
output
).
toContain
(
`Using webpack 4. Reason: webpack5 flag is set to false in next.config.js`
)
})
it
(
'should disable X-Powered-By header support'
,
async
()
=>
{
it
(
'should disable X-Powered-By header support'
,
async
()
=>
{
const
url
=
`http://localhost:
${
context
.
appPort
}
/`
const
url
=
`http://localhost:
${
context
.
appPort
}
/`
const
header
=
(
await
fetch
(
url
)).
headers
.
get
(
'X-Powered-By'
)
const
header
=
(
await
fetch
(
url
)).
headers
.
get
(
'X-Powered-By'
)
...
...
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