Skip to content

Commit 281ae41

Browse files
authoredOct 3, 2023
Fix build output logging order (#56335)
Closes NEXT-1671 Move "Finalizing" to the bottom, and print tree view after file tracing spinner ### After ``` ✓ Generating static pages (5/5) ✓ Collecting build traces ✓ Finalizing page optimization Route (app) Size First Load JS ┌ ○ / 133 B 80 kB └ ○ /_not-found 876 B 80.8 kB + First Load JS shared by all 79.9 kB ├ chunks/main-app-f7da6251716e8121.js 78.2 kB └ chunks/webpack-bf1a64d1eafd2816.js 1.66 kB ``` ### Before ``` ✓ Generating static pages (5/5) ✓ Finalizing page optimization Collecting build traces .Route (app) Size First Load JS ┌ ○ / 133 B 80 kB └ ○ /_not-found 876 B 80.8 kB + First Load JS shared by all 79.9 kB ├ chunks/main-app-f7da6251716e8121.js 78.2 kB └ chunks/webpack-bf1a64d1eafd2816.js 1.66 kB ○ (Static) automatically rendered as static HTML (uses no initial props) ✓ Collecting build traces ```
1 parent d7626ff commit 281ae41

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed
 

‎packages/next/src/build/index.ts

+18-18
Original file line numberDiff line numberDiff line change
@@ -2080,7 +2080,6 @@ export default async function build(
20802080

20812081
await exportApp(dir, exportOptions, nextBuildSpan)
20822082

2083-
const postBuildSpinner = createSpinner('Finalizing page optimization')
20842083
ssgNotFoundPaths = exportConfig.ssgNotFoundPaths
20852084

20862085
// remove server bundles that were exported
@@ -2531,12 +2530,10 @@ export default async function build(
25312530
JSON.stringify(pagesManifest, null, 2),
25322531
'utf8'
25332532
)
2534-
2535-
if (postBuildSpinner) postBuildSpinner.stopAndPersist()
2536-
console.log()
25372533
})
25382534
}
25392535

2536+
const postBuildSpinner = createSpinner('Finalizing page optimization')
25402537
let buildTracesSpinner = createSpinner(`Collecting build traces`)
25412538

25422539
// ensure the worker is not left hanging
@@ -2697,20 +2694,6 @@ export default async function build(
26972694
return Promise.reject(err)
26982695
})
26992696

2700-
await nextBuildSpan.traceChild('print-tree-view').traceAsyncFn(() =>
2701-
printTreeView(pageKeys, pageInfos, {
2702-
distPath: distDir,
2703-
buildId: buildId,
2704-
pagesDir,
2705-
useStaticPages404,
2706-
pageExtensions: config.pageExtensions,
2707-
appBuildManifest,
2708-
buildManifest,
2709-
middlewareManifest,
2710-
gzipSize: config.experimental.gzipSize,
2711-
})
2712-
)
2713-
27142697
if (debugOutput) {
27152698
nextBuildSpan
27162699
.traceChild('print-custom-routes')
@@ -2857,6 +2840,23 @@ export default async function build(
28572840
buildTracesSpinner = undefined
28582841
}
28592842

2843+
if (postBuildSpinner) postBuildSpinner.stopAndPersist()
2844+
console.log()
2845+
2846+
await nextBuildSpan.traceChild('print-tree-view').traceAsyncFn(() =>
2847+
printTreeView(pageKeys, pageInfos, {
2848+
distPath: distDir,
2849+
buildId: buildId,
2850+
pagesDir,
2851+
useStaticPages404,
2852+
pageExtensions: config.pageExtensions,
2853+
appBuildManifest,
2854+
buildManifest,
2855+
middlewareManifest,
2856+
gzipSize: config.experimental.gzipSize,
2857+
})
2858+
)
2859+
28602860
await nextBuildSpan
28612861
.traceChild('telemetry-flush')
28622862
.traceAsyncFn(() => telemetry.flush())

0 commit comments

Comments
 (0)
Please sign in to comment.