App with Module federation doesn't load all scripts
See original GitHub issueBug report
What is the current behavior? There are a few apps configured with ModuleFederationPlugin:
- main (loads one component from i_service and one component from b_service)
- i_service that exposes one component to main app
- b_service that exposes one component to main app
When I start main app I see only the first loaded component. i_service and b_service expose components with the same hierarchy and naming (./src/common/components/Router/Router) and I guess this is the issue (name collision)
If the current behavior is a bug, please provide the steps to reproduce.
Repos:
- main app (https://github.com/siarhei-zharnasek/main-app)
- b_service (https://github.com/siarhei-zharnasek/b_service)
- i_service (https://github.com/siarhei-zharnasek/i_service)
npm install
and npm start
in every repo will start 3 apps (localhost:8080, localhost:8081, localhost:8082)
- open localhost:8080
- click to
Billing
in navigation, this will load Billing page - click to
Identity
in navigation and page stays the same (should load component from another service)
Also this reproducible when you load Billing and Identity later.
What is the expected behavior?
Main app should load both components and resolve chunk even with the same name
Other relevant information: webpack version: 5.4.0 Node.js version: 14.15.1 Operating System: Windows Additional tools:
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (8 by maintainers)
you must have different
output.uniqueName
s in each app. This defaults the to"name"
inpackage.json
. Make sure the each repo has a different"name"
in thepackage.json
.@sokra applications had the same name (copypasted) and making them unique fixed the issue, thanks!