File tree 4 files changed +23
-17
lines changed
4 files changed +23
-17
lines changed Original file line number Diff line number Diff line change
1
+ export function durationToString ( compilerDuration : number ) {
2
+ let durationString
3
+ if ( compilerDuration > 120 ) {
4
+ durationString = `${ ( compilerDuration / 60 ) . toFixed ( 1 ) } min`
5
+ } else if ( compilerDuration > 40 ) {
6
+ durationString = `${ compilerDuration . toFixed ( 0 ) } s`
7
+ } else if ( compilerDuration > 2 ) {
8
+ durationString = `${ compilerDuration . toFixed ( 1 ) } s`
9
+ } else {
10
+ durationString = `${ ( compilerDuration * 1000 ) . toFixed ( 0 ) } ms`
11
+ }
12
+ return durationString
13
+ }
Original file line number Diff line number Diff line change @@ -209,6 +209,7 @@ import { turbopackBuild } from './turbopack-build'
209
209
import { isPersistentCachingEnabled } from '../shared/lib/turbopack/utils'
210
210
import { inlineStaticEnv } from '../lib/inline-static-env'
211
211
import { populateStaticEnv } from '../lib/static-env'
212
+ import { durationToString } from './duration-to-string'
212
213
213
214
type Fallback = null | boolean | string
214
215
@@ -3725,17 +3726,3 @@ export default async function build(
3725
3726
}
3726
3727
}
3727
3728
}
3728
-
3729
- function durationToString ( compilerDuration : number ) {
3730
- let durationString
3731
- if ( compilerDuration > 120 ) {
3732
- durationString = `${ ( compilerDuration / 60 ) . toFixed ( 1 ) } min`
3733
- } else if ( compilerDuration > 40 ) {
3734
- durationString = `${ compilerDuration . toFixed ( 0 ) } s`
3735
- } else if ( compilerDuration > 2 ) {
3736
- durationString = `${ compilerDuration . toFixed ( 1 ) } s`
3737
- } else {
3738
- durationString = `${ ( compilerDuration * 1000 ) . toFixed ( 0 ) } ms`
3739
- }
3740
- return durationString
3741
- }
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ import type { UnwrapPromise } from '../../lib/coalesced-function'
40
40
41
41
import origDebug from 'next/dist/compiled/debug'
42
42
import { Telemetry } from '../../telemetry/storage'
43
+ import { durationToString } from '../duration-to-string'
43
44
44
45
const debug = origDebug ( 'next:build:webpack-build' )
45
46
@@ -340,12 +341,15 @@ export async function webpackBuildImpl(
340
341
err . code = 'WEBPACK_ERRORS'
341
342
throw err
342
343
} else {
344
+ const duration = webpackBuildEnd [ 0 ]
345
+ const durationString = durationToString ( duration )
346
+
343
347
if ( result . warnings . length > 0 ) {
344
- Log . warn ( ' Compiled with warnings\n' )
348
+ Log . warn ( ` Compiled with warnings in ${ durationString } \n` )
345
349
console . warn ( result . warnings . filter ( Boolean ) . join ( '\n\n' ) )
346
350
console . warn ( )
347
351
} else if ( ! compilerName ) {
348
- Log . event ( ' Compiled successfully' )
352
+ Log . event ( ` Compiled successfully in ${ durationString } ` )
349
353
}
350
354
351
355
return {
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
11
11
getParsedNodeOptionsWithoutInspect ,
12
12
} from '../../server/lib/utils'
13
13
import { mergeUseCacheTrackers } from '../webpack/plugins/telemetry-plugin/use-cache-tracker-utils'
14
+ import { durationToString } from '../duration-to-string'
14
15
15
16
const debug = origDebug ( 'next:build:webpack-build' )
16
17
@@ -119,7 +120,8 @@ async function webpackBuildWithWorker(
119
120
}
120
121
121
122
if ( compilerNames . length === 3 ) {
122
- Log . event ( 'Compiled successfully' )
123
+ const durationString = durationToString ( combinedResult . duration )
124
+ Log . event ( `Compiled successfully in ${ durationString } ` )
123
125
}
124
126
125
127
return combinedResult
You can’t perform that action at this time.
0 commit comments