Component modifications are not applied in module federation
See original GitHub issueI’m having an issue getting react refresh working on a project with module fedration. The ws connection is working, also in the console it seems its working, but the modifications are not applied to the component.
[webpack-dev-server] App updated. Recompiling...
index.js:3210 [webpack-dev-server] App hot update...
log.js:24 [HMR] Checking for updates on the server...
log.js:24 [HMR] Updated modules:
log.js:24 [HMR] - ./src/Button.js
log.js:24 [HMR] App is up to date.
I have created an basic example: https://github.com/kabel2/module-federation-examples/tree/feature/example-react-refresh/basic-host-remote
Changing the innertext of the button in the “Button.js” component in “app2” does not apply the changes live, only after reload.
With the old react-hot-loader it seems to work.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:15 (4 by maintainers)
Top Results From Across the Web
Component modifications are not applied in module federation -
I'm having an issue getting react refresh working on a project with module fedration. The ws connection is working, also in the console...
Read more >Webpack module federation is not working with eager shared ...
I used dynamic load technique for my remote library and it seems shared modules are not being fetched again and again now.
Read more >Module Federation - webpack
Changes to the components library can be separately deployed without the need to re-deploy all applications. The application automatically uses the up-to-date ...
Read more >Getting Out of Version-Mismatch-Hell with Module Federation
The reason is that dynamic remotes are not known at program start, and hence Module Federation cannot draw their versions into consideration ...
Read more >How We Implemented Webpack Module Federation in Ares
Thus, the dependency between our applications will be minimized and we will not need to export every component we add to remote applications...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone who runs into this issue, the solution from @ije and @danieloprado in https://github.com/pmmmwh/react-refresh-webpack-plugin/pull/516 works perfectly for me.
I end up with
pnpm patch
to patch the package, you can also do it withyarn patch
if you’re usingyarn
.@pmmmwh would you reconsider applying the changes suggested by @ije and @danieloprado?
Does anyone have an example how react-refresh etc. should be loaded on the page in order for hot reload to work?
In my module federation setup, hot reload works occasionally, which suggests there’s some indeterminism going on in the order that scripts are loading on the page.
The suggestion of bundling react-refresh separately, placing it in window and then making it external in MF libs does not seem to work.