Skip to content

Commit

Permalink
show webpack/turbopack compilation duration for next build (vercel#71146
Browse files Browse the repository at this point in the history
)

### What?

show webpack/turbopack compilation duration for next build
  • Loading branch information
sokra authored Oct 11, 2024
1 parent 4907044 commit 72693e2
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1625,8 +1625,9 @@ export default async function build(
)
}

const time = process.hrtime(startTime)
return {
duration: process.hrtime(startTime)[0],
duration: time[0] + time[1] / 1e9,
buildTraceContext: undefined,
shutdownPromise,
}
Expand Down Expand Up @@ -1686,11 +1687,19 @@ export default async function build(

buildTraceContext = rest.buildTraceContext

Log.event('Compiled successfully')
if (compilerDuration > 2) {
Log.event(
`Compiled successfully in ${Math.round(compilerDuration)}s`
)
} else {
Log.event(
`Compiled successfully in ${Math.round(compilerDuration * 1000)}ms`
)
}

telemetry.record(
eventBuildCompleted(pagesPaths, {
durationInSeconds: compilerDuration,
durationInSeconds: Math.round(compilerDuration),
totalAppPagesCount,
})
)
Expand Down

0 comments on commit 72693e2

Please sign in to comment.