externals @module-federation/webpack-bundler-runtime no work!
Describe the bug
externals: { ... '@module-federation/webpack-bundler-runtime': 'MFWBR', '@module-federation/webpack-bundler-runtime/constant': 'MFWBRCT', ... },
Reproduction
...
Used Package Manager
pnpm
System Info
System:
OS: macOS 14.4.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 74.85 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.13.1 - ~/.nvm/versions/node/v20.13.1/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.5.2 - ~/.nvm/versions/node/v20.13.1/bin/npm
pnpm: 8.15.5 - ~/Library/pnpm/pnpm
bun: 1.0.25 - ~/.bun/bin/bun
Watchman: 2024.05.06.00 - /usr/local/bin/watchman
Browsers:
Chrome: 125.0.6422.78
Safari: 17.4.1
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.
You cannot exclude the @module-federation/webpack-bundler-runtime dependency via external because it is injected via template
使用多个模块联邦的话会有性能问题!
Bundler runtime is stateful I think. It's also quite small. You should look at externalizing the runtime package not the bundler runtime package. That's webpacks runtime code, you want that internalized. Bundler runtime used to be what was in webpacks MF1 runtime modules. Its webpack_require basically.
got it,The runtime package has been externalized. I am considering whether it can also be externalized together to further reduce the size.
I don't think so since it attaches itself to webpack and uses the context of the runtime. But I know we are looking at how to reduce the payload size / allow something like shared for the runtime so if someone has it, others won't load it.
I believe we need to change some of our architecture to support this. But we are planning to look into it.
nice!
Stale issue message
Stale issue message
Should be better once shareable runtime is avaliable
Stale issue message
Bump
Stale issue message
Bundler runtime is stateful I think. It's also quite small. You should look at externalizing the runtime package not the bundler runtime package. That's webpacks runtime code, you want that internalized. Bundler runtime used to be what was in webpacks MF1 runtime modules. Its webpack_require basically.
@ScriptedAlchemy Hi, I noticed that this issue has been closed. I'm wondering if there are any effective solutions to the problem of the entry file size?
I conducted a test in the apps/router-demo/router-remote1-2001 sub-repository. The size of the packaged remoteEntry.js reached 80k.
Even after setting experiments.externalRuntime, the size was still 40k.
In one of my projects, after injecting polyfill using swc-loader, the file size even exceeded 100k. With the same configuration, when using the builtin MF 1.5 of Rspack, the size of the remoteEntry.js is only 18k. This will have a significant impact on page resource loading on pages with multiple remote projects.
Thank you for your answers in advance~
Size should be https://github.com/module-federation/core/pull/3519 14k now