File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
packages/chrome-devtools/src/utils/chrome Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @module-federation/devtools ' : patch
3
+ ---
4
+
5
+ fix(chrome-devtools): fix sharedInfo conflict with userOptions.sharedInfo cause hmr fail
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ const fastRefreshPlugin = (): FederationRuntimePlugin => {
13
13
name : 'mf-fast-refresh-plugin' ,
14
14
beforeInit ( { userOptions, ...args } ) {
15
15
const shareInfo = userOptions . shared ;
16
+ const twinsShareInfo = args . shareInfo ;
16
17
let enableFastRefresh : boolean ;
17
18
let devtoolsMessage ;
18
19
@@ -37,7 +38,15 @@ const fastRefreshPlugin = (): FederationRuntimePlugin => {
37
38
? shareInfo [ share ]
38
39
: [ shareInfo [ share ] ] ;
39
40
40
- sharedArr . forEach ( ( shared ) => {
41
+ let twinsSharedArr : Shared [ ] ;
42
+ if ( twinsShareInfo ) {
43
+ // @ts -expect-error
44
+ twinsSharedArr = Array . isArray ( twinsShareInfo [ share ] )
45
+ ? twinsShareInfo [ share ]
46
+ : [ twinsShareInfo [ share ] ] ;
47
+ }
48
+
49
+ sharedArr . forEach ( ( shared , idx ) => {
41
50
let get : ( ) => any ;
42
51
if ( share === 'react' ) {
43
52
get = ( ) =>
@@ -78,6 +87,9 @@ const fastRefreshPlugin = (): FederationRuntimePlugin => {
78
87
return ( ) => window . ReactDOM ;
79
88
} ;
80
89
}
90
+ if ( twinsShareInfo ) {
91
+ twinsSharedArr [ idx ] . get = shared . get ;
92
+ }
81
93
}
82
94
} ) ;
83
95
} ) ;
You can’t perform that action at this time.
0 commit comments