@@ -64,6 +64,8 @@ export class FullBundleDevEnvironment extends DevEnvironment {
6464 }
6565
6666 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
6769 debug ?.(
6870 `BUNDLING: file update detected ${ file } , retriggering bundle generation` ,
6971 )
@@ -291,6 +293,7 @@ export class FullBundleDevEnvironment extends DevEnvironment {
291293 signal : AbortSignal ,
292294 ) {
293295 try {
296+ const startTime = Date . now ( )
294297 const newMemoryFiles = new Map < string , string | Uint8Array > ( )
295298 for ( const outputOpts of arraify ( outOpts ) ) {
296299 const output = await bundle . generate ( outputOpts )
@@ -303,6 +306,7 @@ export class FullBundleDevEnvironment extends DevEnvironment {
303306 )
304307 }
305308 }
309+ const generateTime = Date . now ( )
306310
307311 this . memoryFiles . clear ( )
308312 for ( const [ file , code ] of newMemoryFiles ) {
@@ -314,6 +318,7 @@ export class FullBundleDevEnvironment extends DevEnvironment {
314318 this . watchFiles . add ( file )
315319 }
316320 if ( signal . aborted ) return
321+ const postGenerateTime = Date . now ( )
317322
318323 if ( this . state . type === 'initial' ) throw new Error ( 'unreachable' )
319324 this . state = {
@@ -322,7 +327,9 @@ export class FullBundleDevEnvironment extends DevEnvironment {
322327 options : this . state . options ,
323328 patched : false ,
324329 }
325- debug ?.( 'BUNDLED: bundle generated' )
330+ debug ?.(
331+ `BUNDLED: bundle generated in ${ generateTime - startTime } ms + ${ postGenerateTime - generateTime } ms` ,
332+ )
326333
327334 this . hot . send ( { type : 'full-reload' } )
328335 this . logger . info ( colors . green ( `page reload` ) , { timestamp : true } )
0 commit comments