Attemping to use inject-external-runtime-core-plugin results in error
Describe the bug
When I try to use @module-federation/inject-external-runtime-core-plugin, I get the following error
ERROR in ../node_modules/@module-federation/runtime/dist/core.esm.mjs 3:0-58
export 'default' (reexported as 'default') was not found in '@module-federation/runtime-core' (possible exports: CurrentGlobal, FederationHost, Global, Module, addGlobalSnapshot, assert, getGlobalFederationConstructor, getGlobalSnapshot, getInfoWithoutType, getRegisteredShare, getRemoteEntry, getRemoteInfo, helpers, isStaticResourcesEqual, loadScript, loadScriptNode, matchRemoteWithNameAndExpose, registerGlobalPlugins, resetFederationGlobalInfo, safeWrapper, satisfy, setGlobalFederationConstructor, setGlobalFederationInstance, types)
The reason for this error is that the "published" file @module-federation/runtime/dist/core.esm.mjs contains the following
import runtimeCore__default from '@module-federation/runtime-core';
export * from '@module-federation/runtime-core';
export { default } from '@module-federation/runtime-core';
Notice the third line export { default } from '@module-federation/runtime-core';. There is no default export in this package. This leads to the error above. I can fix this by manually patching the file to remove the extra export { default } line. Interestingly looking at the source, I think rollup is messing up the output.
To reproduce, run the stackblitz link, run npm start and watch the error overlay.
Reproduction
https://stackblitz.com/edit/github-2vfygo-pkyh5azi?file=app1%2Fwebpack.config.js
Used Package Manager
npm
System Info
System:
OS: macOS 14.7
CPU: (10) arm64 Apple M1 Max
Memory: 21.02 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.20.4 - ~/.nvm/versions/node/v18.20.4/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.19.4 - ~/Projects/foo/bar/node_modules/.bin/npm
bun: 1.1.20 - ~/.bun/bin/bun
Browsers:
Chrome: 131.0.6778.265
Safari: 17.6
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.
@2heal1 can you have a look
Stale issue message
@tmpaul do you want to send us a PR. It'll likely get merged faster that way
Stale issue message