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
199d2e96
Unverified
Commit
199d2e96
authored
Nov 24, 2024
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Nov 24, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "ensure webpack worker exits bubble to parent process (#72921)" (#73136)
parent
7b0ab1ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
14 deletions
+34
-14
index.ts
packages/next/src/build/webpack-build/index.ts
+34
-14
No files found.
packages/next/src/build/webpack-build/index.ts
View file @
199d2e96
...
@@ -2,8 +2,9 @@ import type { COMPILER_INDEXES } from '../../shared/lib/constants'
...
@@ -2,8 +2,9 @@ import type { COMPILER_INDEXES } from '../../shared/lib/constants'
import
*
as
Log
from
'../output/log'
import
*
as
Log
from
'../output/log'
import
{
NextBuildContext
}
from
'../build-context'
import
{
NextBuildContext
}
from
'../build-context'
import
type
{
BuildTraceContext
}
from
'../webpack/plugins/next-trace-entrypoints-plugin'
import
type
{
BuildTraceContext
}
from
'../webpack/plugins/next-trace-entrypoints-plugin'
import
{
Worker
}
from
'
../../lib/
worker'
import
{
Worker
}
from
'
next/dist/compiled/jest-
worker'
import
origDebug
from
'next/dist/compiled/debug'
import
origDebug
from
'next/dist/compiled/debug'
import
type
{
ChildProcess
}
from
'child_process'
import
path
from
'path'
import
path
from
'path'
import
{
exportTraceState
,
recordTraceEvents
}
from
'../../trace'
import
{
exportTraceState
,
recordTraceEvents
}
from
'../../trace'
...
@@ -37,17 +38,35 @@ async function webpackBuildWithWorker(
...
@@ -37,17 +38,35 @@ async function webpackBuildWithWorker(
prunedBuildContext
.
pluginState
=
pluginState
prunedBuildContext
.
pluginState
=
pluginState
const
worker
=
new
Worker
(
path
.
join
(
__dirname
,
'impl.js'
),
{
const
getWorker
=
(
compilerName
:
string
)
=>
{
exposedMethods
:
[
'workerMain'
],
const
_worker
=
new
Worker
(
path
.
join
(
__dirname
,
'impl.js'
),
{
numWorkers
:
1
,
exposedMethods
:
[
'workerMain'
],
maxRetries
:
0
,
numWorkers
:
1
,
forkOptions
:
{
maxRetries
:
0
,
env
:
{
forkOptions
:
{
...
process
.
env
,
env
:
{
NEXT_PRIVATE_BUILD_WORKER
:
'1'
,
...
process
.
env
,
NEXT_PRIVATE_BUILD_WORKER
:
'1'
,
},
},
},
},
})
as
Worker
&
typeof
import
(
'./impl'
)
})
as
Worker
&
typeof
import
(
'./impl'
)
_worker
.
getStderr
().
pipe
(
process
.
stderr
)
_worker
.
getStdout
().
pipe
(
process
.
stdout
)
for
(
const
worker
of
((
_worker
as
any
).
_workerPool
?.
_workers
||
[])
as
{
_child
:
ChildProcess
}[])
{
worker
.
_child
.
on
(
'exit'
,
(
code
,
signal
)
=>
{
if
(
code
||
(
signal
&&
signal
!==
'SIGINT'
))
{
debug
(
`Compiler
${
compilerName
}
unexpectedly exited with code:
${
code
}
and signal:
${
signal
}
`
)
}
})
}
return
_worker
}
const
combinedResult
=
{
const
combinedResult
=
{
duration
:
0
,
duration
:
0
,
...
@@ -55,6 +74,8 @@ async function webpackBuildWithWorker(
...
@@ -55,6 +74,8 @@ async function webpackBuildWithWorker(
}
}
for
(
const
compilerName
of
compilerNames
)
{
for
(
const
compilerName
of
compilerNames
)
{
const
worker
=
getWorker
(
compilerName
)
const
curResult
=
await
worker
.
workerMain
({
const
curResult
=
await
worker
.
workerMain
({
buildContext
:
prunedBuildContext
,
buildContext
:
prunedBuildContext
,
compilerName
,
compilerName
,
...
@@ -67,6 +88,8 @@ async function webpackBuildWithWorker(
...
@@ -67,6 +88,8 @@ async function webpackBuildWithWorker(
if
(
nextBuildSpan
&&
curResult
.
debugTraceEvents
)
{
if
(
nextBuildSpan
&&
curResult
.
debugTraceEvents
)
{
recordTraceEvents
(
curResult
.
debugTraceEvents
)
recordTraceEvents
(
curResult
.
debugTraceEvents
)
}
}
// destroy worker so it's not sticking around using memory
await
worker
.
end
()
// Update plugin state
// Update plugin state
pluginState
=
deepMerge
(
pluginState
,
curResult
.
pluginState
)
pluginState
=
deepMerge
(
pluginState
,
curResult
.
pluginState
)
...
@@ -102,9 +125,6 @@ async function webpackBuildWithWorker(
...
@@ -102,9 +125,6 @@ async function webpackBuildWithWorker(
}
}
}
}
// destroy worker so it's not sticking around using memory
worker
.
end
()
if
(
compilerNames
.
length
===
3
)
{
if
(
compilerNames
.
length
===
3
)
{
Log
.
event
(
'Compiled successfully'
)
Log
.
event
(
'Compiled successfully'
)
}
}
...
...
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