question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WP5 Module Federation refresh remoteEntry and/or external modules

See original GitHub issue

Feature 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:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
raixcommented, Jan 6, 2021

@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?

0reactions
alexander-akaitcommented, Jul 18, 2022

@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…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Micro-frontends: Module Federation with WebPack 5
It is basically a JavaScript architecture. It allows a JavaScript application to dynamically load code from another application (a different ...
Read more >
Webpack 5 Module Federation: A game-changer in JavaScript ...
A scalable solution to sharing code between independent applications has never been convenient, and near impossible at scale.
Read more >
Federated Module Reloading. - Medium
What is Federated Module Reloading (FMR)? FMR is a Webpack plugin that keeps distributed apps up-to-date in the browser whenever one of their ......
Read more >
Building micro-frontends with webpack's Module Federation
Learn to simplify app architecture by using webpack 5's Module Federation to consume and share micro-frontend components with a Vue example.
Read more >
How to Build a Micro Frontend with Webpack's Module ...
Federated code defines their dependencies and if Webpack can't find it in the scope, will download it. Module Federation Configuration Options.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found