graph LR
entry-light["entry-light.js"] -->|"import { light }"| barrel["barrel.js"]
entry-heavy["entry-heavy.js"] -->|"import { createService }"| barrel
barrel -->|"import { HeavyService }"| heavy["heavy.js"]
barrel -->|"export { light }"| light["light.js"]
light:::leaf
heavy:::leaf
classDef leaf fill:#e8f5e9,stroke:#388e3c
What problem does this feature solve?
graph LR entry-light["entry-light.js"] -->|"import { light }"| barrel["barrel.js"] entry-heavy["entry-heavy.js"] -->|"import { createService }"| barrel barrel -->|"import { HeavyService }"| heavy["heavy.js"] barrel -->|"export { light }"| light["light.js"] light:::leaf heavy:::leaf classDef leaf fill:#e8f5e9,stroke:#388e3chttps://github.com/sapphi-red-repros/barrel-split-export-repro
For example, if
heavy.jsis marked as sideeffect free, we can ignore that import when bundlinglight.js. So we can have with 2 chunks like Rollup does. But Rolldown now generates 3 chunks: one for entry-light, one for entry-heavy, one for the shared barrel file.What does the proposed API look like?
Not an API change
Although I'm not sure how the other bundlers define "sideEffect-free" for modules. We need to change this definition to do this optimization.
Originally reported at vitejs/vite#21966