@@ -186,7 +186,7 @@ export async function createCompiler(options: InitConfigsOptions): Promise<{
186186 } ) ;
187187 }
188188
189- const printTime = ( index : number ) => {
189+ const printTime = ( index : number , hasErrors : boolean ) => {
190190 if ( startTime === null ) {
191191 return ;
192192 }
@@ -197,13 +197,19 @@ export async function createCompiler(options: InitConfigsOptions): Promise<{
197197
198198 // When using multiple compilers, print the name to distinguish different environments
199199 const suffix = isMultiCompiler ? color . dim ( ` (${ name } )` ) : '' ;
200- logger . ready ( `built in ${ prettyTime ( time / 1000 ) } ${ suffix } ` ) ;
200+ const timeStr = `${ prettyTime ( time / 1000 ) } ${ suffix } ` ;
201+
202+ if ( hasErrors ) {
203+ logger . error ( `build failed in ${ timeStr } ` ) ;
204+ } else {
205+ logger . ready ( `built in ${ timeStr } ` ) ;
206+ }
201207 } ;
202208
203209 if ( isMultiCompiler ) {
204210 ( compiler as Rspack . MultiCompiler ) . compilers . forEach ( ( item , index ) => {
205- item . hooks . done . tap ( HOOK_NAME , ( ) => {
206- printTime ( index ) ;
211+ item . hooks . done . tap ( HOOK_NAME , ( stats ) => {
212+ printTime ( index , stats . hasErrors ( ) ) ;
207213 } ) ;
208214 } ) ;
209215 }
@@ -219,10 +225,6 @@ export async function createCompiler(options: InitConfigsOptions): Promise<{
219225 context . buildState . hasErrors = hasErrors ;
220226 context . socketServer ?. onBuildDone ( ) ;
221227
222- if ( ! isMultiCompiler ) {
223- printTime ( 0 ) ;
224- }
225-
226228 const { message, level } = formatStats ( stats , hasErrors ) ;
227229
228230 if ( level === 'error' ) {
@@ -231,6 +233,9 @@ export async function createCompiler(options: InitConfigsOptions): Promise<{
231233 if ( level === 'warning' ) {
232234 logger . warn ( message ) ;
233235 }
236+ if ( ! isMultiCompiler ) {
237+ printTime ( 0 , hasErrors ) ;
238+ }
234239
235240 isCompiling = false ;
236241 } ,
0 commit comments