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 44
55### Patch Changes
66
7+ - fix(modern-js-plugin): set bridge.disableAlias true when installing @module-federation/bridge-react
78- 41ee332: chore(modern-js-plugin): re-export all bridge react
89- Updated dependencies [ 8004e95]
910- Updated dependencies [ 0bf3a3a]
Original file line number Diff line number Diff line change 11import path from 'path' ;
2+ import fs from 'fs' ;
23import { getIPV4 , isWebTarget , skipByTarget } from './utils' ;
34import { moduleFederationPlugin , encodeName } from '@module-federation/sdk' ;
45import { bundle } from '@modern-js/node-bundle-require' ;
@@ -162,6 +163,26 @@ export const patchMFConfig = (
162163
163164 const runtimePlugins = [ ...( mfConfig . runtimePlugins || [ ] ) ] ;
164165
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+ }
165186 patchDTSConfig ( mfConfig , isServer ) ;
166187
167188 injectRuntimePlugins (
You can’t perform that action at this time.
0 commit comments