fix ESM default export handling for .mjs files in Module Federation by y-okt · Pull Request #20189 · webpack/webpack

@y-okt mentioned this pull request

Nov 29, 2025

@y-okt 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

Nov 29, 2025

alexander-akait

alexander-akait

@y-okt y-okt mentioned this pull request

Dec 2, 2025

5 tasks

y-okt added a commit to y-okt/webpack that referenced this pull request

Dec 14, 2025
use 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, 2025
remove 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".
fix failed linting for lib classes

@alexander-akait @y-okt

as pointed out in PR review, their values are less
so remove these
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 hai-x mentioned this pull request

Dec 23, 2025