File tree 2 files changed +18
-2
lines changed 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @module-federation/node ' : patch
3
+ ---
4
+
5
+ fix: remove chunks from installedChunks on fail to enable retries
Original file line number Diff line number Diff line change @@ -235,6 +235,15 @@ export const installChunk = (
235
235
}
236
236
} ;
237
237
238
+ // Hoisted utility function to remove a chunk on fail
239
+ export const deleteChunk = (
240
+ chunkId : string ,
241
+ installedChunks : { [ key : string ] : any } ,
242
+ ) : boolean => {
243
+ delete installedChunks [ chunkId ] ;
244
+ return true ;
245
+ } ;
246
+
238
247
// Hoisted function to set up webpack script loader
239
248
export const setupScriptLoader = ( ) : void => {
240
249
__webpack_require__ . l = (
@@ -297,7 +306,8 @@ export const setupChunkHandler = (
297
306
chunkId ,
298
307
__webpack_require__ . federation . rootOutputDir || '' ,
299
308
( err , chunk ) => {
300
- if ( err ) return reject ( err ) ;
309
+ if ( err )
310
+ return deleteChunk ( chunkId , installedChunks ) && reject ( err ) ;
301
311
if ( chunk ) installChunk ( chunk , installedChunks ) ;
302
312
resolve ( chunk ) ;
303
313
} ,
@@ -312,7 +322,8 @@ export const setupChunkHandler = (
312
322
chunkName ,
313
323
__webpack_require__ . federation . initOptions . name ,
314
324
( err , chunk ) => {
315
- if ( err ) return reject ( err ) ;
325
+ if ( err )
326
+ return deleteChunk ( chunkId , installedChunks ) && reject ( err ) ;
316
327
if ( chunk ) installChunk ( chunk , installedChunks ) ;
317
328
resolve ( chunk ) ;
318
329
} ,
You can’t perform that action at this time.
0 commit comments