File tree Expand file tree Collapse file tree 6 files changed +193
-142
lines changed
bridge/bridge-react/src/provider Expand file tree Collapse file tree 6 files changed +193
-142
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
1
+ ---
2
+ ' @module-federation/bridge-react ' : patch
3
+ ---
4
+
5
+ feat: add error detection for react v19 under the default export createBaseBridgeComponent
Original file line number Diff line number Diff line change 142
142
"@storybook/node-logger" : " 8.1.11" ,
143
143
"@storybook/react" : " 8.3.5" ,
144
144
"@svgr/webpack" : " 8.1.0" ,
145
- "@swc-node/register" : " 1.10.9 " ,
145
+ "@swc-node/register" : " 1.10.10 " ,
146
146
"@swc/cli" : " 0.5.0" ,
147
147
"@swc/core" : " 1.7.26" ,
148
148
"@swc/helpers" : " 0.5.13" ,
Original file line number Diff line number Diff line change @@ -30,6 +30,16 @@ function defaultCreateRoot(
30
30
} {
31
31
const reactVersion = ReactDOM . version || '' ;
32
32
const isReact18 = reactVersion . startsWith ( '18' ) ;
33
+ const isReact19 = reactVersion . startsWith ( '19' ) ;
34
+
35
+ // For React 19, throw error and suggest using version-specific import
36
+ if ( isReact19 ) {
37
+ throw new Error (
38
+ `React 19 detected. The default export is not compatible with React 19. ` +
39
+ `Please use the version-specific import instead: ` +
40
+ `import { createBridgeComponent } from '@module-federation/bridge-react/v19'` ,
41
+ ) ;
42
+ }
33
43
34
44
// For React 18, use createRoot API
35
45
if ( isReact18 ) {
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