Repository navigation
feat(code-splitting): support inlining of shared deps in dynamic entries - #10526
Conversation
c13398a to
4a86117
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
f4bf47a to
13693e0
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
wait, i'm working on the other feedback still. |
f678d65 to
a82b388
Compare
|
Done :) in a82b388 |
|
Thanks again for the work here — I re-reviewed the branch and ran a detailed side-by-side against an alternative implementation. I don't think we should land it in its current shape. One blocking finding, one secondary, and a proposal for how to converge. Blocking: external star re-exports are dropped from the extracted namespace. For a dynamic entry with an entry-level // app.js (dynamic entry whose shared dep gets inlined)
export * from 'node:path';
export const done = import('./lazy.js').then((m) => m.value);
// main.js
const app = await import('./app.js');
typeof app.sep; // expected 'string' — actual: 'undefined' on this branchThe chunk still emits Secondary: extraction cost on the partial-usage path. For this issue's own repro the Proposal. I've put up a stacked alternative that addresses both: #10532 (merge when partial usage proves the extra exports unobservable — no extraction machinery, leaner than Rollup on this graph), #10560 (extraction for opaque usage via the existing To be clear, the direction here was right — the two implementations converge on identical output wherever this branch is correct. And the Full comparison data — per-test chunk counts & correctness, emitted bytes, implementation shape, guard coverage (every cell measured by running the fixture under the named implementation)Setup
Per-test: chunk count and correctness
Rows 2–3 are byte-identical outputs between the stack and this PR. Rows 8–10 are one bug class: the extraction namespace enumerates only build-time-known exports, so runtime-supplied names vanish. Under the stack, #10560 alone keeps rows 8–10 at 4 chunks (correct, refused); #10559 lifts them to 3 with the runtime merge. Emitted bytes for the issue's own graph (unminified)
Where extraction is genuinely needed (opaque usage), stack and PR outputs are byte-identical — the delta exists only where the stack's tier-1 proves extraction unnecessary. Implementation shape
Guard-boundary coverage
|
I don't think this is correct? I added a test case that shows that in that case |
Good suggestion, done in 73d0bfd (EDIT: afcb666 now that I rebased). |
3bd195c to
afcb666
Compare
…ay into shared helpers
…try when used exports are known
afcb666 to
39e1945
Compare
✅ Deploy Preview for rolldown-rs canceled.
|
## [1.2.2] - 2026-08-03 ### 🚀 Features - code-splitting: support inlining of shared deps in dynamic entries (#10526) by @nicolo-ribaudo - plugin: time the user callbacks configured on the options (#10509) by @IWANABETHATGUY ### 🐛 Bug Fixes - dev: force `cleanDir` off in dev mode (#10579) by @shulaoda - dev: keep `?rolldown-lazy` proxy ids out of user `resolveId` hooks (#10580) by @btea - initialize re-exported wrapped ESM modules at the entry chunk (#10567) by @hyfdev - link: resolve circular star reexports as null (#10445) by @Nic-Polumeyv - transform: transformer gate skips newer syntax that oxc can lower (#10564) by @sekyungk - code-splitting: materialize consumer-local barrel routing when the order-wrap plan is empty (#10544) by @hyfdev - plugin: measure plugin hooks in JavaScript, report them from Rust (#10508) by @IWANABETHATGUY - plugin: include external dynamic imports in chunk metadata (#10557) by @hyfdev - plugin: report plugin timings after closeBundle has run (#10521) by @IWANABETHATGUY - browser: avoid using node builtin modules (#10542) by @sapphi-red ### 🚜 Refactor - plugin: give the build's own clocks their own type (#10520) by @shulaoda ### 📚 Documentation - correct stale `buildStart` comment in `ScanStageCache::merge` (#10577) by @shulaoda - update outdated pluginutils references (#10574) by @dogledogle ### ⚡ Performance - external: drop the runtime import from chunks that never wrap (#10517) by @IWANABETHATGUY - plugin: clock the build only when it is being measured (#10558) by @IWANABETHATGUY ### 🧪 Testing - vite-tests: drop the dead `@rolldown/pluginutils` pnpm override (#10575) by @IWANABETHATGUY - transform: group the transform-target fixtures and say why each exists (#10569) by @IWANABETHATGUY - dev: fix hmr-hot-update-hook-vite fixture on Windows (#10565) by @h-a-n-a - dev: match Vite's renamed full-reload log (#10547) by @shulaoda ### ⚙️ Miscellaneous Tasks - deps: update napi (#10576) by @renovate[bot] - deps: bump `@napi-rs/wasm-runtime` to 1.2.2 (#10570) by @shulaoda - deps: update npm packages (#10583) by @renovate[bot] - deps: update dependency rolldown-plugin-dts to ^0.28.0 (#10588) by @renovate[bot] - deps: update taiki-e/install-action action to v2.85.5 (#10587) by @renovate[bot] - deps: update codspeedhq/action action to v5 (#10584) by @renovate[bot] - deps: update github actions (#10582) by @renovate[bot] - deps: update rust crates (#10581) by @renovate[bot] - deps: update dependency vite-plus to v0.2.7 (#10568) by @renovate[bot] - deps: update dependency rolldown-plugin-dts to v0.27.14 (#10531) by @renovate[bot] - deps: update pnpm to v11.17.0 (#10571) by @renovate[bot] - deps: update @napi-rs/wasm-runtime to 1.2.1 (#10545) by @sapphi-red ### ❤️ New Contributors * @sekyungk made their first contribution in [#10564](#10564) * @nicolo-ribaudo made their first contribution in [#10526](#10526) Co-authored-by: shulaoda <[email protected]>
This PR fixes #10263 by aligning Rolldown's behavior with Rollup's: modules can be inlined into dynamic entry chunks, but when doing so we must generate a fake namespace object that we use at the dynamic import site, to avoid exposing the extra exports.
This is my first time contributing to Rolldown. I split this PR into three commits hoping that it makes things easier to review:
I also used an LLM to figure out where to even make this change, and to generate the extra tests included in the last commit.