Module federation remote loader
Hi, I've recently developed a better solution to loading remote scripts.
Consider require.loadChunk or webpack_require.l(url,event,id)
This will leverage webpacks own chunk loader for loading remote containers the same way import(remote/module) does within webpack module factories.
It's by far the most reliable solution.
@ScriptedAlchemy thanks for the heads-up! I've grepped the webpack and module-federation-examples repos for any examples but didn't find any occurrences or examples. Can you point me to something?
The https://github.com/module-federation/module-federation-examples/tree/master/advanced-api/automatic-vendor-sharing are quite the use case which we're tackling here. Except that I do not even want to expose/load individual modules from my separate bundles, but everything which is defined in them and which they depend on :)
This is on npm as module-federation/utilities
Might need some adjustments to the file since it's got a loop for runtime remotes on there. (Send a pr if you want me to maintain script injection)
https://github.com/module-federation/nextjs-mf/blob/main/packages/utilities/src/utils/common.ts
Ive published it to npm, so you can use it via module-federation/utilities.
Just a heads up - I still have this on my radar, but I'm short on time diving into that right now. Have to prepare next week's Plone conference training and my talk about module federation in Plone (resp. Patternslib) where I will revisit this proposal for sure :)