Is there a guide for how to use React Bridge for Webpack based Applications? #3559
-
We are currently using Module Federation enhanced. We use the build plugin in our webpack config, to consume and provide remote modules. However, I have been trying to use the Bridge Component documentation specified here and I have been running to issues Our use case is that we want to upgrade remote applications to React 17 while the host app is on React 16. The documentation is using rsbuild, but there is also this plugin, which I don't know what it is for. And this guide: Has anyone successfully used Webpack and bridge together? I am very confused on what to do. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
We are going to work backwards from this example: |
Beta Was this translation helpful? Give feedback.
-
We got this working, sharing the solution here to give back. This is our Host Application's Build Configuration:
We also had add this line to our resolve configuration:
Then at runtime to dynamically load components we use:
This is an example of a remote application, this file is exposed in the exposes config in a "producer" app. For this app, we also removed all shared singletons. "@module-federation/bridge-react": "0.11.1",
We have other applications that are not updated to react 17, and they are working on the same host app. This functionality allows us to upgrade each app one by one. Our Host app is at react 16, other applications even on the same page use the shared singletons where as the React 17 app does not. We can also confirm this by looking at the Module Federation Dev Tool. |
Beta Was this translation helpful? Give feedback.
We got this working, sharing the solution here to give back.
This is our Host Application's Build Configuration:
"@module-federation/bridge-react": "0.11.1",
"@module-federation/enhanced": "0.11.1",
"@module-federation/retry-plugin": "^0.11.1",
"@module-federation/webpack-bundler-runtime": "0.11.1",