Replies: 2 comments 7 replies
-
|
Wrap importRemote in a retry function that waits and retries if a chunk fails |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
Yes, you need an extra code for this logic, we try to be align how |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Bug report
What is the current behavior?
Using https://github.com/module-federation/core/blob/main/packages/utilities/src/utils/importRemote.ts, and the import fails with "Loading chunk xxx failed", a subsequent call to
importRemotewith the same module will not try to reload the missing chunk.Stepping through the code, it appears that this is because where a chunk fails to load, the entry in
startedInstallModulesis still set to true, and so it isn't later reloaded.I tested with reseting the value in
startedInstallModulesto false. In this case, the chunk is loaded, but then I ran into another problem. In "bootstrap", it finds a "cached module" and returns it even though its "loaded" flag is false. Turning onstrictModuleErrorHandlingdoesn't solve it since it just throws the previous exception. But turning onstrictModuleExceptionHandlingdoes fix it since it causes the module to be initialized again.What is the expected behavior?
There should be a way to reload a module (and dependencies) that previously failed to completely load.
There was a comment about match how
importworks for ESM. I found the following on MDN:Importantly, it states that module loading failures should not be cached, but currently webpack does "cache" module loading failures, both in that it does not retry loading (because of
startedInstallModules) and that because loading failures are deferred to module evaluation, those modules don't get re-evaluated after the module is reloaded.Other relevant information:
webpack version: 5.98.0
Node.js version: 18.20.7
Operating System: Windows 11
Additional tools:
Beta Was this translation helpful? Give feedback.
All reactions