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
7c66dbbd
Commit
7c66dbbd
authored
Nov 02, 2025
by
Tim Neutkens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build: Log amount of workers during static generation
parent
2c56a693
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
13 deletions
+27
-13
index.ts
packages/next/src/build/index.ts
+14
-7
index.ts
packages/next/src/export/index.ts
+3
-1
index.test.ts
test/integration/polyfills/test/index.test.ts
+2
-2
index.test.ts
test/production/pages-dir/production/test/index.test.ts
+8
-3
No files found.
packages/next/src/build/index.ts
View file @
7c66dbbd
...
@@ -836,6 +836,7 @@ export type StaticWorker = typeof import('./worker') & Worker
...
@@ -836,6 +836,7 @@ export type StaticWorker = typeof import('./worker') & Worker
export
function
createStaticWorker
(
export
function
createStaticWorker
(
config
:
NextConfigComplete
,
config
:
NextConfigComplete
,
options
:
{
options
:
{
numberOfWorkers
:
number
debuggerPortOffset
:
number
debuggerPortOffset
:
number
progress
?:
{
progress
?:
{
run
:
()
=>
void
run
:
()
=>
void
...
@@ -843,10 +844,10 @@ export function createStaticWorker(
...
@@ -843,10 +844,10 @@ export function createStaticWorker(
}
}
}
}
):
StaticWorker
{
):
StaticWorker
{
const
{
debuggerPortOffset
,
progress
}
=
options
const
{
numberOfWorkers
,
debuggerPortOffset
,
progress
}
=
options
return
new
Worker
(
staticWorkerPath
,
{
return
new
Worker
(
staticWorkerPath
,
{
logger
:
Log
,
logger
:
Log
,
numWorkers
:
getNumberOfWorkers
(
config
)
,
numWorkers
:
numberOfWorkers
,
onActivity
:
()
=>
{
onActivity
:
()
=>
{
progress
?.
run
()
progress
?.
run
()
},
},
...
@@ -1915,8 +1916,11 @@ export default async function build(
...
@@ -1915,8 +1916,11 @@ export default async function build(
traceMemoryUsage
(
'Finished type checking'
,
nextBuildSpan
)
traceMemoryUsage
(
'Finished type checking'
,
nextBuildSpan
)
}
}
const
numberOfWorkers
=
getNumberOfWorkers
(
config
)
const
collectingPageDataStart
=
process
.
hrtime
()
const
collectingPageDataStart
=
process
.
hrtime
()
const
postCompileSpinner
=
createSpinner
(
'Collecting page data'
)
const
postCompileSpinner
=
createSpinner
(
`Collecting page data using
${
numberOfWorkers
}
worker
${
numberOfWorkers
>
1
?
's'
:
''
}
`
)
const
buildManifestPath
=
path
.
join
(
distDir
,
BUILD_MANIFEST
)
const
buildManifestPath
=
path
.
join
(
distDir
,
BUILD_MANIFEST
)
...
@@ -1958,7 +1962,10 @@ export default async function build(
...
@@ -1958,7 +1962,10 @@ export default async function build(
process
.
env
.
NEXT_PHASE
=
PHASE_PRODUCTION_BUILD
process
.
env
.
NEXT_PHASE
=
PHASE_PRODUCTION_BUILD
const
worker
=
createStaticWorker
(
config
,
{
debuggerPortOffset
:
-
1
})
const
worker
=
createStaticWorker
(
config
,
{
numberOfWorkers
,
debuggerPortOffset
:
-
1
,
})
const
analysisBegin
=
process
.
hrtime
()
const
analysisBegin
=
process
.
hrtime
()
const
staticCheckSpan
=
nextBuildSpan
.
traceChild
(
'static-check'
)
const
staticCheckSpan
=
nextBuildSpan
.
traceChild
(
'static-check'
)
...
@@ -2480,7 +2487,7 @@ export default async function build(
...
@@ -2480,7 +2487,7 @@ export default async function build(
if
(
postCompileSpinner
)
{
if
(
postCompileSpinner
)
{
const
collectingPageDataEnd
=
process
.
hrtime
(
collectingPageDataStart
)
const
collectingPageDataEnd
=
process
.
hrtime
(
collectingPageDataStart
)
postCompileSpinner
.
setText
(
postCompileSpinner
.
setText
(
`Collecting page data in
${
hrtimeDurationToString
(
collectingPageDataEnd
)}
`
`Collecting page data
using
${
numberOfWorkers
}
worker
${
numberOfWorkers
>
1
?
's'
:
''
}
in
${
hrtimeDurationToString
(
collectingPageDataEnd
)}
`
)
)
postCompileSpinner
.
stopAndPersist
()
postCompileSpinner
.
stopAndPersist
()
}
}
...
@@ -3063,8 +3070,8 @@ export default async function build(
...
@@ -3063,8 +3070,8 @@ export default async function build(
debugPrerender
,
debugPrerender
,
pages
:
combinedPages
,
pages
:
combinedPages
,
outdir
,
outdir
,
statusMessage
:
'Generating static pages'
,
statusMessage
:
`Generating static pages using
${
numberOfWorkers
}
worker
${
numberOfWorkers
>
1
?
's'
:
''
}
`
,
numWorkers
:
getNumberOfWorkers
(
exportConfig
)
,
numWorkers
:
numberOfWorkers
,
appDirOnly
,
appDirOnly
,
},
},
nextBuildSpan
nextBuildSpan
...
...
packages/next/src/export/index.ts
View file @
7c66dbbd
...
@@ -641,13 +641,15 @@ async function exportAppImpl(
...
@@ -641,13 +641,15 @@ async function exportAppImpl(
if
(
totalExportPaths
>
0
)
{
if
(
totalExportPaths
>
0
)
{
const
progress
=
createProgress
(
const
progress
=
createProgress
(
totalExportPaths
,
totalExportPaths
,
options
.
statusMessage
||
'Exporting'
options
.
statusMessage
??
`Exporting using
${
options
.
numWorkers
}
worker
${
options
.
numWorkers
>
1
?
's'
:
''
}
`
)
)
worker
=
createStaticWorker
(
nextConfig
,
{
worker
=
createStaticWorker
(
nextConfig
,
{
debuggerPortOffset
:
getNextBuildDebuggerPortOffset
({
debuggerPortOffset
:
getNextBuildDebuggerPortOffset
({
kind
:
'export-page'
,
kind
:
'export-page'
,
}),
}),
numberOfWorkers
:
options
.
numWorkers
,
progress
,
progress
,
})
})
...
...
test/integration/polyfills/test/index.test.ts
View file @
7c66dbbd
...
@@ -49,8 +49,8 @@ describe('Polyfills', () => {
...
@@ -49,8 +49,8 @@ describe('Polyfills', () => {
})
})
it
(
'should contain generated page count in output'
,
async
()
=>
{
it
(
'should contain generated page count in output'
,
async
()
=>
{
expect
(
output
).
toContain
(
'Generating static pages (0/5)'
)
expect
(
output
).
match
(
/Generating static pages.*
\(
0
\/
5
\)
/g
)
expect
(
output
).
toContain
(
'Generating static pages (5/5)'
)
expect
(
output
).
match
(
/Generating static pages.*
\(
5
\/
5
\)
/g
)
// we should only have 1 segment and the initial message logged out
// we should only have 1 segment and the initial message logged out
expect
(
output
.
match
(
/Generating static pages/g
).
length
).
toBe
(
5
)
expect
(
output
.
match
(
/Generating static pages/g
).
length
).
toBe
(
5
)
})
})
...
...
test/production/pages-dir/production/test/index.test.ts
View file @
7c66dbbd
...
@@ -112,9 +112,14 @@ describe('Production Usage', () => {
...
@@ -112,9 +112,14 @@ describe('Production Usage', () => {
it
(
'should contain generated page count in output'
,
async
()
=>
{
it
(
'should contain generated page count in output'
,
async
()
=>
{
const
pageCount
=
34
const
pageCount
=
34
expect
(
next
.
cliOutput
).
toContain
(
`Generating static pages (0/
${
pageCount
}
)`
)
expect
(
next
.
cliOutput
).
toMatch
(
expect
(
next
.
cliOutput
).
toContain
(
new
RegExp
(
`Generating static pages.*\\(0\\/
${
pageCount
}
\\)`
,
'g'
)
`Generating static pages (
${
pageCount
}
/
${
pageCount
}
)`
)
expect
(
next
.
cliOutput
).
toMatch
(
new
RegExp
(
`Generating static pages.*\\(
${
pageCount
}
\\/
${
pageCount
}
\\)`
,
'g'
)
)
)
// we should only have 4 segments and the initial message logged out
// we should only have 4 segments and the initial message logged out
expect
(
next
.
cliOutput
.
match
(
/Generating static pages/g
).
length
).
toBe
(
5
)
expect
(
next
.
cliOutput
.
match
(
/Generating static pages/g
).
length
).
toBe
(
5
)
...
...
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