Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

externals @module-federation/webpack-bundler-runtime no work! #2539

Open
5 tasks done
ckken opened this issue May 24, 2024 · 7 comments
Open
5 tasks done

externals @module-federation/webpack-bundler-runtime no work! #2539

ckken opened this issue May 24, 2024 · 7 comments
Assignees

Comments

@ckken
Copy link

ckken commented May 24, 2024

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

@ckken
Copy link
Author

ckken commented May 24, 2024

image

@zhoushaw
Copy link
Collaborator

You cannot exclude the @module-federation/webpack-bundler-runtime dependency via external because it is injected via template

@zhoushaw zhoushaw self-assigned this May 28, 2024
@ckken
Copy link
Author

ckken commented May 28, 2024

使用多个模块联邦的话会有性能问题!

@ScriptedAlchemy
Copy link
Member

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.

@ckken
Copy link
Author

ckken commented Jun 3, 2024

got it,The runtime package has been externalized. I am considering whether it can also be externalized together to further reduce the size.

@ScriptedAlchemy
Copy link
Member

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.

@ckken
Copy link
Author

ckken commented Jun 3, 2024

nice!

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

No branches or pull requests

4 participants