@@ -104,7 +104,7 @@ export class FullBundleDevEnvironment extends DevEnvironment {
104
104
patched : this . state . patched ,
105
105
}
106
106
107
- let hmrOutput : HmrOutput
107
+ let hmrOutput : HmrOutput | undefined
108
108
try {
109
109
// NOTE: only single outputOptions is supported here
110
110
hmrOutput = await this . state . bundle . generateHmrPatch ( [ file ] )
@@ -121,6 +121,11 @@ export class FullBundleDevEnvironment extends DevEnvironment {
121
121
return
122
122
}
123
123
124
+ if ( ! hmrOutput ) {
125
+ debug ?.( `ignored file change for ${ file } ` )
126
+ return
127
+ }
128
+
124
129
this . handleHmrOutput ( file , hmrOutput , this . state )
125
130
return
126
131
}
@@ -356,50 +361,41 @@ export class FullBundleDevEnvironment extends DevEnvironment {
356
361
return
357
362
}
358
363
359
- // TODO: handle `No corresponding module found for changed file path`
360
- if (
361
- hmrOutput . code &&
362
- hmrOutput . code !== '__rolldown_runtime__.applyUpdates([]);'
363
- ) {
364
- debug ?.( `handle hmr output for ${ file } ` , {
365
- ...hmrOutput ,
366
- code : typeof hmrOutput . code === 'string' ? '[code]' : hmrOutput . code ,
367
- } )
368
-
369
- this . memoryFiles . set ( hmrOutput . filename , hmrOutput . code )
370
- if ( hmrOutput . sourcemapFilename && hmrOutput . sourcemap ) {
371
- this . memoryFiles . set ( hmrOutput . sourcemapFilename , hmrOutput . sourcemap )
372
- }
373
- const updates : Update [ ] = hmrOutput . hmrBoundaries . map ( ( boundary : any ) => {
374
- return {
375
- type : 'js-update' ,
376
- url : hmrOutput . filename ,
377
- path : boundary . boundary ,
378
- acceptedPath : boundary . acceptedVia ,
379
- firstInvalidatedBy : hmrOutput . firstInvalidatedBy ,
380
- timestamp : 0 ,
381
- }
382
- } )
383
- this . hot . send ( {
384
- type : 'update' ,
385
- updates,
386
- } )
387
- this . logger . info (
388
- colors . green ( `hmr update ` ) +
389
- colors . dim ( [ ...new Set ( updates . map ( ( u ) => u . path ) ) ] . join ( ', ' ) ) ,
390
- { clear : ! hmrOutput . firstInvalidatedBy , timestamp : true } ,
391
- )
364
+ debug ?.( `handle hmr output for ${ file } ` , {
365
+ ...hmrOutput ,
366
+ code : typeof hmrOutput . code === 'string' ? '[code]' : hmrOutput . code ,
367
+ } )
392
368
393
- this . state = {
394
- type : 'bundled' ,
395
- options,
396
- bundle,
397
- patched : true ,
398
- }
399
- return
369
+ this . memoryFiles . set ( hmrOutput . filename , hmrOutput . code )
370
+ if ( hmrOutput . sourcemapFilename && hmrOutput . sourcemap ) {
371
+ this . memoryFiles . set ( hmrOutput . sourcemapFilename , hmrOutput . sourcemap )
400
372
}
373
+ const updates : Update [ ] = hmrOutput . hmrBoundaries . map ( ( boundary : any ) => {
374
+ return {
375
+ type : 'js-update' ,
376
+ url : hmrOutput . filename ,
377
+ path : boundary . boundary ,
378
+ acceptedPath : boundary . acceptedVia ,
379
+ firstInvalidatedBy : hmrOutput . firstInvalidatedBy ,
380
+ timestamp : 0 ,
381
+ }
382
+ } )
383
+ this . hot . send ( {
384
+ type : 'update' ,
385
+ updates,
386
+ } )
387
+ this . logger . info (
388
+ colors . green ( `hmr update ` ) +
389
+ colors . dim ( [ ...new Set ( updates . map ( ( u ) => u . path ) ) ] . join ( ', ' ) ) ,
390
+ { clear : ! hmrOutput . firstInvalidatedBy , timestamp : true } ,
391
+ )
401
392
402
- debug ?.( `ignored file change for ${ file } ` )
393
+ this . state = {
394
+ type : 'bundled' ,
395
+ options,
396
+ bundle,
397
+ patched : true ,
398
+ }
403
399
}
404
400
}
405
401
0 commit comments