1
- import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack ' ;
1
+ import { pluginModuleFederation } from '@module-federation/rsbuild-plugin ' ;
2
2
import { defineConfig } from '@rsbuild/core' ;
3
3
import { pluginReact } from '@rsbuild/plugin-react' ;
4
4
import path from 'path' ;
@@ -14,28 +14,25 @@ export default defineConfig({
14
14
server : {
15
15
port : 2000 ,
16
16
} ,
17
- tools : {
18
- rspack : ( config , { appendPlugins } ) => {
19
- appendPlugins ( [
20
- new ModuleFederationPlugin ( {
21
- name : 'federation_consumer' ,
22
- remotes : {
23
- remote1 : 'remote1@http://localhost:2001/mf-manifest.json' ,
24
- remote2 : 'remote2@http://localhost:2002/mf-manifest.json' ,
25
- remote3 : 'remote3@http://localhost:2003/mf-manifest.json' ,
26
- 'remote-render-error' :
27
- 'remote-render-error@http://localhost:2004/mf-manifest.json' ,
28
- 'remote-resource-error' :
29
- 'remote-resource-errorr@http://localhost:2008/not-exist-mf-manifest.json' ,
30
- } ,
31
- shared : [ 'react' , 'react-dom' , 'antd' ] ,
32
- runtimePlugins : [
33
- path . join ( __dirname , './src/runtime-plugin/shared-strategy.ts' ) ,
34
- // path.join(__dirname, './src/runtime-plugin/retry.ts'),
35
- ] ,
36
- } ) ,
37
- ] ) ;
38
- } ,
39
- } ,
40
- plugins : [ pluginReact ( ) ] ,
17
+ plugins : [
18
+ pluginReact ( ) ,
19
+ pluginModuleFederation ( {
20
+ name : 'federation_consumer' ,
21
+ shareStrategy : 'loaded-first' ,
22
+ remotes : {
23
+ remote1 : 'remote1@http://localhost:2001/mf-manifest.json' ,
24
+ remote2 : 'remote2@http://localhost:2002/mf-manifest.json' ,
25
+ remote3 : 'remote3@http://localhost:2003/mf-manifest.json' ,
26
+ 'remote-render-error' :
27
+ 'remote-render-error@http://localhost:2004/mf-manifest.json' ,
28
+ 'remote-resource-error' :
29
+ 'remote-resource-errorr@http://localhost:2008/not-exist-mf-manifest.json' ,
30
+ } ,
31
+ shared : [ 'react' , 'react-dom' , 'antd' ] ,
32
+ runtimePlugins : [
33
+ path . join ( __dirname , './src/runtime-plugin/shared-strategy.ts' ) ,
34
+ // path.join(__dirname, './src/runtime-plugin/retry.ts'),
35
+ ] ,
36
+ } ) ,
37
+ ] ,
41
38
} ) ;
0 commit comments