vite-plugin-federation
vite-plugin-federation copied to clipboard
Remotes under different name
Is your feature request related to a problem? Please describe.
Webpack's MF plugin supports using a modified name of a remote module. This is something I've been missing since I do not always intend to refer the remote module using its original name. What is more, I believe this will help us introduce dynamic/deferred modules resolution - the dynamic modules still have to be 'stubbed' in the config. In webpack this is possible by providing just the name without the full url, which can be supplied at a later time.
Describe the solution you'd like
The idea I came up with is to simply extend remotes configuration object with optional externalName, which would have to be the same name as the module's name in the host's config. Doing so would allow us to modify the id (config item key) of the module.
Describe alternatives you've considered
The way webpack deals with the problem:
altModuleName: 'origModuleName@http://localhost:3001/remoteEntry.js',
However, I am not certain it would be a great idea to introduce '@' support without bumping the major version up (as it could potentially be a breaking change - I know '@' is restricted but I cannot be sure if people do not somehow use it in the URLs).
If you would rather go with '@', I am open to changing my solution.
that's a great fix, I have similar problem
I have similar problem too, any news?