Host application takes too long to start in dev mode after updating @module-federation/enhanced
Describe the bug
After upgrading @module-federation/enhanced from 0.1.15 to 0.11.1, the host application took almost 3 minutes to start in development mode (npm run dev), instead of the expected few seconds.
The issue seems to occur specifically when a module is both exposed and consumed by the same application. This combination seems to trigger a significant delay in startup time for the host application.
When this happens, the host application takes almost 3 minutes to start, while the remote applications now start faster than before, which is a positive change. However, this issue only affects development mode, and production builds (npm run build) are not impacted.
Interestingly, running NODE_ENV=production npm run dev eliminates the problem, suggesting that the issue is tied specifically to the development environment when dealing with both exposed and consumed modules within the same application.
Reproduction
https://github.com/FrancicoVerdu/MF_BuildTime
Used Package Manager
npm
System Info
System:
OS: Linux 6.8 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
CPU: (20) x64 13th Gen Intel(R) Core(TM) i7-13700H
Memory: 18.80 GB / 31.08 GB
Container: Yes
Shell: 3.7.1 - /usr/bin/fish
Binaries:
Node: 20.13.1 - ~/.local/share/nvm/v20.13.1/bin/node
Yarn: 1.22.22 - ~/.local/share/nvm/v20.13.1/bin/yarn
npm: 10.5.2 - ~/.local/share/nvm/v20.13.1/bin/npm
Browsers:
Chrome: 134.0.6998.88
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.