fix ESM default export handling for .mjs files in Module Federation by y-okt · Pull Request #20189 · webpack/webpack
y-okt
changed the title
lib: fix ESM default export handling for .mjs files in Module Federation
fix ESM default export handling for .mjs files in Module Federation
y-okt
mentioned this pull request
5 tasks
y-okt added a commit to y-okt/webpack that referenced this pull request
Dec 14, 2025use namespace rather than dynamic in js importing mjs case Fixes: webpack#20189
y-okt added a commit to y-okt/webpack that referenced this pull request
Dec 15, 2025remove module federation implementation to separately do so in another MR Fixes: webpack#20189
When .mjs files import a default export from a shared/remote module in Module Federation, they receive the ESM namespace object instead of the actual default export value. The solution of this approach is to override the getExportsType() method in ConsumeSharedModule and RemoteModule to always return "dynamic".
use namespace rather than dynamic in js importing mjs case Fixes: webpack#20189
remove module federation implementation to separately do so in another MR Fixes: webpack#20189
This was referenced
Dec 22, 2025
hai-x
mentioned this pull request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters