@@ -62,6 +62,7 @@ export class MemoryFiles {
62
62
63
63
export class FullBundleDevEnvironment extends DevEnvironment {
64
64
private state : BundleState = { type : 'initial' }
65
+ private invalidateCalledModules = new Set < string > ( )
65
66
66
67
watchFiles = new Set < string > ( )
67
68
memoryFiles = new MemoryFiles ( )
@@ -160,6 +161,8 @@ export class FullBundleDevEnvironment extends DevEnvironment {
160
161
patched : this . state . patched ,
161
162
}
162
163
return
164
+ } finally {
165
+ this . invalidateCalledModules . clear ( )
163
166
}
164
167
165
168
if ( hmrOutput . every ( ( output ) => output . type === 'Noop' ) ) {
@@ -189,13 +192,20 @@ export class FullBundleDevEnvironment extends DevEnvironment {
189
192
firstInvalidatedBy : string
190
193
} ) : void {
191
194
; ( async ( ) => {
195
+ if ( this . invalidateCalledModules . has ( m . path ) ) {
196
+ debug ?.(
197
+ `${ this . state . type . toUpperCase ( ) } : invalidate received, but ignored because it was already invalidated` ,
198
+ )
199
+ return
200
+ }
201
+
192
202
if (
193
203
this . state . type === 'initial' ||
194
204
this . state . type === 'bundling' ||
195
205
this . state . type === 'bundle-error'
196
206
) {
197
207
debug ?.(
198
- `${ this . state . type . toUpperCase ( ) } : invalidate received, but ignored` ,
208
+ `${ this . state . type . toUpperCase ( ) } : invalidate received, but ignored because the state type has changed ` ,
199
209
)
200
210
return
201
211
}
@@ -212,6 +222,7 @@ export class FullBundleDevEnvironment extends DevEnvironment {
212
222
bundle : this . state . bundle ,
213
223
patched : this . state . patched ,
214
224
}
225
+ this . invalidateCalledModules . add ( m . path )
215
226
216
227
let hmrOutput : HmrOutput
217
228
try {
@@ -430,7 +441,7 @@ export class FullBundleDevEnvironment extends DevEnvironment {
430
441
path : boundary . boundary ,
431
442
acceptedPath : boundary . acceptedVia ,
432
443
firstInvalidatedBy,
433
- timestamp : 0 ,
444
+ timestamp : Date . now ( ) ,
434
445
}
435
446
} )
436
447
this . hot . send ( {
0 commit comments