File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 4
4
5
5
### Patch Changes
6
6
7
+ - fix(modern-js-plugin): set bridge.disableAlias true when installing @module-federation/bridge-react
7
8
- 41ee332: chore(modern-js-plugin): re-export all bridge react
8
9
- Updated dependencies [ 8004e95]
9
10
- Updated dependencies [ 0bf3a3a]
Original file line number Diff line number Diff line change 1
1
import path from 'path' ;
2
+ import fs from 'fs' ;
2
3
import { getIPV4 , isWebTarget , skipByTarget } from './utils' ;
3
4
import { moduleFederationPlugin , encodeName } from '@module-federation/sdk' ;
4
5
import { bundle } from '@modern-js/node-bundle-require' ;
@@ -162,6 +163,26 @@ export const patchMFConfig = (
162
163
163
164
const runtimePlugins = [ ...( mfConfig . runtimePlugins || [ ] ) ] ;
164
165
166
+ try {
167
+ const nodeModulesPath = path . resolve ( process . cwd ( ) , 'node_modules' ) ;
168
+ const bridgeReactPath = path . join (
169
+ nodeModulesPath ,
170
+ '@module-federation/bridge-react' ,
171
+ ) ;
172
+ if (
173
+ fs . existsSync ( bridgeReactPath ) &&
174
+ ( ! mfConfig ?. bridge || ! mfConfig . bridge . disableAlias )
175
+ ) {
176
+ mfConfig . bridge = {
177
+ disableAlias : true ,
178
+ } ;
179
+ logger . debug (
180
+ `${ PLUGIN_IDENTIFIER } use "@module-federation/modern-js/react" instead of "@module-federation/bridge-react" !` ,
181
+ ) ;
182
+ }
183
+ } catch ( e ) {
184
+ // noop
185
+ }
165
186
patchDTSConfig ( mfConfig , isServer ) ;
166
187
167
188
injectRuntimePlugins (
You can’t perform that action at this time.
0 commit comments