File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed 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,7 @@ 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 ) return deleteChunk ( chunkId , installedChunks ) && reject ( err ) ;
301
310
if ( chunk ) installChunk ( chunk , installedChunks ) ;
302
311
resolve ( chunk ) ;
303
312
} ,
@@ -312,7 +321,7 @@ export const setupChunkHandler = (
312
321
chunkName ,
313
322
__webpack_require__ . federation . initOptions . name ,
314
323
( err , chunk ) => {
315
- if ( err ) return reject ( err ) ;
324
+ if ( err ) return deleteChunk ( chunkId , installedChunks ) && reject ( err ) ;
316
325
if ( chunk ) installChunk ( chunk , installedChunks ) ;
317
326
resolve ( chunk ) ;
318
327
} ,
You can’t perform that action at this time.
0 commit comments