@@ -64,6 +64,8 @@ export class FullBundleDevEnvironment extends DevEnvironment {
64
64
}
65
65
66
66
if ( this . state . type === 'bundling' ) {
67
+ // FIXME: we should retrigger only when we know that file is watched.
68
+ // but for the initial bundle we don't know that and need to trigger after the initial bundle
67
69
debug ?.(
68
70
`BUNDLING: file update detected ${ file } , retriggering bundle generation` ,
69
71
)
@@ -291,6 +293,7 @@ export class FullBundleDevEnvironment extends DevEnvironment {
291
293
signal : AbortSignal ,
292
294
) {
293
295
try {
296
+ const startTime = Date . now ( )
294
297
const newMemoryFiles = new Map < string , string | Uint8Array > ( )
295
298
for ( const outputOpts of arraify ( outOpts ) ) {
296
299
const output = await bundle . generate ( outputOpts )
@@ -303,6 +306,7 @@ export class FullBundleDevEnvironment extends DevEnvironment {
303
306
)
304
307
}
305
308
}
309
+ const generateTime = Date . now ( )
306
310
307
311
this . memoryFiles . clear ( )
308
312
for ( const [ file , code ] of newMemoryFiles ) {
@@ -314,6 +318,7 @@ export class FullBundleDevEnvironment extends DevEnvironment {
314
318
this . watchFiles . add ( file )
315
319
}
316
320
if ( signal . aborted ) return
321
+ const postGenerateTime = Date . now ( )
317
322
318
323
if ( this . state . type === 'initial' ) throw new Error ( 'unreachable' )
319
324
this . state = {
@@ -322,7 +327,9 @@ export class FullBundleDevEnvironment extends DevEnvironment {
322
327
options : this . state . options ,
323
328
patched : false ,
324
329
}
325
- debug ?.( 'BUNDLED: bundle generated' )
330
+ debug ?.(
331
+ `BUNDLED: bundle generated in ${ generateTime - startTime } ms + ${ postGenerateTime - generateTime } ms` ,
332
+ )
326
333
327
334
this . hot . send ( { type : 'full-reload' } )
328
335
this . logger . info ( colors . green ( `page reload` ) , { timestamp : true } )
0 commit comments