Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Attemping to use inject-external-runtime-core-plugin results in error #3434

Open
5 tasks done
tmpaul opened this issue Jan 11, 2025 · 1 comment
Open
5 tasks done

Comments

@tmpaul
Copy link

tmpaul commented Jan 11, 2025

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

@ScriptedAlchemy
Copy link
Member

@2heal1 can you have a look

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants