You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
shared-runtime modules is not ideal for shared chunks spltting as it's fully based on code splitting strategy, when you import different exports from a shared module, they could be split into different chunks instead of being grouped into a same output bundle, event they're in the same group of split chunks.
Thus we need to have an entry as input for a shared module, and then alias it like the other chunks. Since now we have the relative exports in #538 , so we could auto generate shared entries based on the #imports field to create shared links.
Proposal
We still want to follow a certain pattern that we could only select few aliases as shared module inputs, then bunchee will only generate the shared entries and output for these entry files. The rest of the alias will just be normal aliases.
Use #[name].shared as the pattern to match all the shared bundles
Then bunchee should create a bundle for #dep.shared, where input file is ./src/dep.shared.js. And the rest follows the rules of normal entries. This could improve the shared modules story and without adding much new convention or patterns to memorize
The text was updated successfully, but these errors were encountered:
I just ran into an issue with shared modules again, where 3 entry points import from a shared runtime, but somehow 3 copies of the shared runtime end up in the dist folder (one for each entry point).
I'll try to work around it by moving the shared runtime to another entry point for the time being, but imports would sound really cool 👍
Background
shared-runtime
modules is not ideal for shared chunks spltting as it's fully based on code splitting strategy, when you import different exports from a shared module, they could be split into different chunks instead of being grouped into a same output bundle, event they're in the same group of split chunks.Thus we need to have an entry as input for a shared module, and then alias it like the other chunks. Since now we have the relative exports in #538 , so we could auto generate shared entries based on the
#imports
field to create shared links.Proposal
We still want to follow a certain pattern that we could only select few aliases as shared module inputs, then bunchee will only generate the shared entries and output for these entry files. The rest of the alias will just be normal aliases.
Use
#[name].shared
as the pattern to match all the shared bundlesThen bunchee should create a bundle for
#dep.shared
, where input file is./src/dep.shared.js
. And the rest follows the rules of normal entries. This could improve the shared modules story and without adding much new convention or patterns to memorizeThe text was updated successfully, but these errors were encountered: