-
-
Notifications
You must be signed in to change notification settings - Fork 359
Description
Describe the bug
Hi there!
We are exploring modern.js to migrate to it from nextjs. After testing the module-federation implementation, following the modernjs-ssr example, we found 3 errors:
1. Uncaught Error: The loadShareSync function was unable to load react. The react could not be found in frontend_admin_panel.
It happens when we do not set shared.[my-lib].eager to true:

I have checked the example file and it doesn't have this config enabled so maybe its a bug in the latest version?
This error happens in the host and provider at the same time.
2. Uncaught TypeError: Cannot read properties of undefined (reading 'call')
This happens in the host when trying to isolate the error in a new repo we found this. Kinda weird because it only happens in the repro repository.
3. Duplicated library (react/react-dom) even when the shared.[my-lib] is configured
I cant reproduce it in the repo but it happened in our internal testing with real projects when trying to connect two repos, 1 with modernjs (host) and 1 using rebuild (provider). We saw in the devtools that the lib_react chunk was loaded two times where the last one is loaded only when the remote module is loaded.
So, maybe we can't use federation with cross tooling? its recommended to always use the same framework or builder in the host and providers?
Let me know if the issue needs more info.
Thanks!!!!!!!!
Reproduction
https://github.com/GiancarlosIO/module-federation-error
Used Package Manager
pnpm
System Info
System:
OS: Windows 11 10.0.22631
CPU: (32) x64 Intel(R) Core(TM) i9-14900K
Memory: 14.02 GB / 31.75 GB
Binaries:
Node: 20.17.0 - ~\AppData\Local\fnm_multishells\14756_1725781672693\node.EXE
npm: 10.8.2 - ~\AppData\Local\fnm_multishells\14756_1725781672693\npm.CMD
pnpm: 9.8.0 - ~\AppData\Local\fnm_multishells\14756_1725781672693\pnpm.CMD
Browsers:
Edge: Chromium (128.0.2739.42)
Internet Explorer: 11.0.22621.3527Validations
- 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.
- Make sure this is a Module federation issue and not a framework-specific issue.
- The provided reproduction is a minimal reproducible example of the bug.


