- Install dependencies
yarn
- Run build
yarn run build
- Start serving
yarn run serve
- Go to http://localhost:3000 and http://localhost:3001
The project demonstrates the bi-directional functionality of webpack module federation. It contains two apps which both depend on each other. App 1 provides a toolbar and App 2 exposes a dummy application component which just shows an animation.
They both load the respective remote component and display the same app with the difference of a simple title.
new ModuleFederationPlugin({
...,
remotes: {
'app2': 'app2'
},
exposes: {
'./App': './app1/App.js'
}
})
new ModuleFederationPlugin({
...,
remotes: {
'app1': 'app1'
},
exposes: {
'./RollingReact': './app2/RollingReact.js'
}
})