-
Notifications
You must be signed in to change notification settings - Fork 90
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
You can't generate more then one remoteEntry.js file per one vite application.
It doesn't fail on build, but it doesn't work properly in runtime.
Vite config example:
plugins: [
federation({
name: 'firstRemote',
filename: 'firstRemoteEntry.js',
exposes: {
'./App1': './src/App1.vue',
},
shared: {
vue: {},
},
}),
federation({
name: 'secondRemote',
filename: 'secondRemoteEntry.js',
manifest: { fileName: 'mf-manifest2.json' }, // generates correctly
exposes: {
'./App2': './src/App2.jsx',
},
shared: {
react: {},
},
}),
]When you load thes remoteEntries:
import { App1 } from '@namespace/viteViteRemote';
import { App2 } from '@namespace/viteViteRemote2';You get error:
Uncaught Error: Module ./App1 does not exist in container.
Looks like there is conflict between two mf remote entries and it takes only the last federation config, thus App2 works and App1 fails
Moreover: second "federation" plugin call breaks the first call. Now only secondRemote works, firstRemote is broken.
I get this problem in both ways:
- with pure
remoteEntry.js - using
mf-manifest.json
Version
v1.9.0
Reproduction
https://github.com/crutch12/vite-module-federation/tree/reproduction/multiple-federation
Relevant log output
Validations
- Read the docs.
- Read the common issues list.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working