RetryPlugin fallback url for scripts
Describe the bug
By implementing the RetryPlugin I am able to return a fallback url like:
import { RetryPlugin } from '@module-federation/retry-plugin';
const retryPlugin = () =>
RetryPlugin({
fetch: {
fallback(_url) { // _url => https://cdn-that-fails.com/app/
return 'http://localhost/app/mf-manifes.tjson'
}
},
});
export default retryPlugin;
it seems that works and I can see the manifest being loaded from the fallback url, but subsequent script requests are loaded from failing CDN URL.
shouldn't the scripts also be loaded from the fallback URL ? or am I missing something ?
Reproduction
https://github.com/kmilov/rerty-plugin-issue
Used Package Manager
npm
System Info
System:
OS: macOS 15.5
CPU: (16) arm64 Apple M4 Max
Memory: 842.73 MB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.11.0 - /usr/local/box/nodejs/bin/node
npm: 11.0.0-pre.0 - /usr/local/box/npm/bin/npm
pnpm: 10.4.1 - ~/local/bin/pnpm
Browsers:
Chrome: 137.0.7151.104
Safari: 18.5
Validations
- [x] Read the docs.
- [x] Read the common issues list.
- [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [x] Make sure this is a Module federation issue and not a framework-specific issue.
- [x] The provided reproduction is a minimal reproducible example of the bug.
@kmilov How can I reproduce in the demo?
@danpeen I just added a README to the Reproduction repo https://github.com/kmilov/rerty-plugin-issue/tree/main
what about using the remotes array fallback pattern instead of a hook? Something like this will also be a way to achieve similar.
'mfe': ['mfe@http://localhost:8083/mf-manifest.json', 'mfe@https://cdn-that-fails.com/app/mf-manifest.json'],
did not know about that, thx @zackarychapple.
Unfortunately does not fit my use case, as I am using registerRemote instead of registering at build time.
Stale issue message