Async modules not resolved correctly with module federation
See original GitHub issueBug report
What is the current behavior? async modules (e.g. using top-level-await) are resolved into promise by Module Federation
If the current behavior is a bug, please provide the steps to reproduce.
https://github.com/vincenthend/webpack-module-federation-async-modules
Repo above is two webpack apps using module-federation
main-app
is importing a function from component-app
, where there is a top-level-await in the imported module.
The imported module is resolved as Promise instead of object (even if using import
syntax)
What is the expected behavior? Imported modules from module federation should resolve normally whether it’s async modules or not
Other relevant information: webpack version: 5.61.0 Node.js version: 14.8 Operating System: macOS 10.15 Additional tools: -
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:10 (7 by maintainers)
Top GitHub Comments
When working with async modules you need to make sure that your are working only with ESM imports. And also make sure to not accidentically transpile them (via babel) to CommonJs (as shown in the screenhot,
(0, _utils).hasRole
is how babel transpiles imports)Imported modules from module federation should resolve normally whether it’s async modules or not
I have the same problem, it seems to be a bug?