Webpack 5 and Module Fed.: Duplication of lib code when using multiple named entry points and eager: true
See original GitHub issueBug report
When having several named entry points and sharing a lib with eager:true
, the lib code is duplicated to all resulting bundles.
Example for entry points:
entry: {
main: "./shell/main",
styles: "./shell/styles.css",
polyfills: "./shell/polyfills"
},
Example for shared:
shared: {
"rxjs": {
eager: true,
singleton: true,
},
}
What is the current behavior?
The shared lib is duplicated to all bundles (main and polyfills in the example shown).
What is the expected behavior?
The shared lib should not be duplicated but only put into one bundle
Other relevant information: webpack version: Every version since webpack 5 Node.js version: 16.13.2 LTS Operating System: windows Additional tools: no
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Module Federation - webpack
A container is created through a container entry, which exposes asynchronous access to the specific modules. The exposed access is separated into two...
Read more >Webpack module federation is not working with eager shared ...
It seems like the main reason of why it failed initially was that remoteEntry.js file was loaded after the code that actually runs...
Read more >Webpack 5 Module Federation: A game-changer in JavaScript ...
A scalable solution to sharing code between independent applications has never been convenient, and near impossible at scale.
Read more >How to Build a Micro Frontend with Webpack's Module ...
Introduced in Webpack 5, the Module Federation plugin gives developers a way to create multiple separate builds that form a single application.
Read more >How to Build a Micro Frontend with Webpack's Module ... - Bitovi
Introduced in Webpack 5, the Module Federation plugin gives developers a way to create multiple separate builds that form a single application.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for this info. At first sight,
dependOn
works nicely:Issue was closed because of inactivity.
If you think this is still a valid issue, please file a new issue with additional information.