WP5 Module Federation refresh remoteEntry and/or external modules
See original GitHub issueFeature request
What is the expected behavior? An external component should be able to invalidate the remoteEntry and cause a refresh of the external module - currently we would have to do a full page reload.
What is motivation or use case for adding/changing the behavior?
- If the app is able to detect a new release of the external component a reload might be required - instead of a full page reload we could refresh the module. (it would likely be the module it self knowing if a refresh is needed)
- If there was an issue in the loaded module eg. a UI Component having an issue - it would be nice to provide a pr. module refresh eg. letting the user trigger a “retry”
- If the external service is down for some reason the fallback module/component could likely detect when the service is up again and trigger a refresh of modules from that service
How should this be implemented in your opinion?
Client code could import a magical import {refresh} from "webpack/module/federation/refresh"
If used as an external module it would communication with the remoteEntry refresh mechanism updating module loader and resetting module cache. (If used in the main application it could either be ignored or trigger a full page reload?)
Are you willing to work on this yourself? yes, despite being low on time and domain knowledge regarding the webpack code base - although the initial work would likely be figuring out if feasible / practical or if a full page reload is better.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:8 (5 by maintainers)
@alexander-akait the module
remoteEntry
files containing the module loading with hashed urls etc. is afaik loaded as part of the main bundle. Unless we create our own custom loading of remote modules I don’t quite see how it would be possible to reload the remoteEntry files and resetting the remote modules for that entry. (By custom I mean our own module loader eg.: Example of manually loading modules from container)I might be missing out on some documentation of the internal webpack api’s?
@rojasjandro89 I undestand your feelings, but bidirectional hmr for module federation is not an easy thing, it is in our roadmap, you can always send a PR
It was closed because we already have an issue about it, it is just a duplicate…