Skip to content

fix(rolldown_plugin_lazy_compilation): use loadExports for fetched proxy to preserve original export names#9132

Merged
graphite-app[bot] merged 1 commit into
mainfrom
04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names
May 11, 2026
Merged

fix(rolldown_plugin_lazy_compilation): use loadExports for fetched proxy to preserve original export names#9132
graphite-app[bot] merged 1 commit into
mainfrom
04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names

Conversation

@h-a-n-a

@h-a-n-a h-a-n-a commented Apr 16, 2026

Copy link
Copy Markdown
Member

Summary

When a dynamic import target ends up in a ChunkKind::Common chunk (shared across multiple entry boundaries), rolldown minifies all its export names. The lazy compilation fetched proxy previously did const mod = await import(...); return mod, passing the raw chunk namespace to user code — so sel.foo became undefined because the actual key was a short alias like $.

Fix: switch the fetched proxy template to use __rolldown_runtime__.loadExports() instead of returning the chunk namespace directly. The runtime registry stores exports with their original names, bypassing the mangled chunk-level exports.

Test plan

Added packages/test-dev-server/tests/playground/lazy-issue-9312

We should probably come up with a lazy compilation test infra that makes writing multiple test cases easier.

h-a-n-a commented Apr 16, 2026

Copy link
Copy Markdown
Member Author

How to use the Graphite Merge Queue

Add the label graphite: merge-when-ready to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@netlify

netlify Bot commented Apr 16, 2026

Copy link
Copy Markdown

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 07da851
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6a01a777914d870008961b25

@h-a-n-a h-a-n-a changed the base branch from main to graphite-base/9132 April 17, 2026 06:07
@h-a-n-a h-a-n-a force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from 77ca16d to 6341d2b Compare April 17, 2026 06:08
@h-a-n-a h-a-n-a changed the base branch from graphite-base/9132 to 04-17-fix_collect_destructured_bindings_in_hmr_module_exports April 17, 2026 06:08
@h-a-n-a h-a-n-a force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from 6341d2b to 77a731d Compare April 17, 2026 06:13
@h-a-n-a h-a-n-a force-pushed the 04-17-fix_collect_destructured_bindings_in_hmr_module_exports branch from 25a1f91 to 625e552 Compare April 17, 2026 06:13
@graphite-app graphite-app Bot changed the base branch from 04-17-fix_collect_destructured_bindings_in_hmr_module_exports to graphite-base/9132 April 17, 2026 16:02
@graphite-app graphite-app Bot force-pushed the graphite-base/9132 branch from 625e552 to f554244 Compare April 17, 2026 16:09
@graphite-app graphite-app Bot force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from 77a731d to 033efca Compare April 17, 2026 16:09
@graphite-app graphite-app Bot changed the base branch from graphite-base/9132 to main April 17, 2026 16:10
@graphite-app graphite-app Bot force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from 033efca to eb0e1fc Compare April 17, 2026 16:10
@h-a-n-a h-a-n-a force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from eb0e1fc to 7487a99 Compare April 21, 2026 07:31
@h-a-n-a h-a-n-a force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from 7487a99 to 496f339 Compare April 21, 2026 10:25
@h-a-n-a h-a-n-a changed the base branch from main to graphite-base/9132 April 27, 2026 07:29
@h-a-n-a h-a-n-a force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from 496f339 to 2aac0e7 Compare April 27, 2026 07:29
@h-a-n-a h-a-n-a changed the base branch from graphite-base/9132 to 04-21-fix_fix_race_condition_of_module_initialization_in_hmr_patches April 27, 2026 07:30
@h-a-n-a h-a-n-a force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from 2aac0e7 to e0f9d72 Compare April 27, 2026 07:43
@h-a-n-a h-a-n-a force-pushed the 04-21-fix_fix_race_condition_of_module_initialization_in_hmr_patches branch 2 times, most recently from b4dc062 to 90d94c1 Compare April 27, 2026 07:45
@h-a-n-a h-a-n-a force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from e0f9d72 to 55ab442 Compare April 27, 2026 07:45
@graphite-app graphite-app Bot changed the base branch from 04-21-fix_fix_race_condition_of_module_initialization_in_hmr_patches to graphite-base/9132 April 27, 2026 08:10
@graphite-app graphite-app Bot force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from 55ab442 to c2554f1 Compare April 27, 2026 08:15
@graphite-app graphite-app Bot force-pushed the graphite-base/9132 branch from 90d94c1 to 27026df Compare April 27, 2026 08:15
@graphite-app graphite-app Bot changed the base branch from graphite-base/9132 to main April 27, 2026 08:15
@graphite-app graphite-app Bot force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from c2554f1 to f2c3464 Compare April 27, 2026 08:15
@h-a-n-a h-a-n-a force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from 872b05f to db8a48f Compare May 6, 2026 06:55
@h-a-n-a h-a-n-a changed the base branch from graphite-base/9132 to 05-06-fix_dev_lazy_lazily_compiled_modules_should_be_watched May 6, 2026 06:55
@h-a-n-a h-a-n-a force-pushed the 05-06-fix_dev_lazy_lazily_compiled_modules_should_be_watched branch from 23d68cf to 8627017 Compare May 6, 2026 06:56
@h-a-n-a h-a-n-a force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from db8a48f to 565a66a Compare May 6, 2026 06:56
@graphite-app graphite-app Bot changed the base branch from 05-06-fix_dev_lazy_lazily_compiled_modules_should_be_watched to graphite-base/9132 May 6, 2026 07:22
@graphite-app graphite-app Bot force-pushed the graphite-base/9132 branch from 8627017 to db46692 Compare May 6, 2026 07:27
@graphite-app graphite-app Bot force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from 565a66a to 65d51b3 Compare May 6, 2026 07:27
@graphite-app graphite-app Bot changed the base branch from graphite-base/9132 to main May 6, 2026 07:28
@graphite-app graphite-app Bot force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from 65d51b3 to ec35a9a Compare May 6, 2026 07:28
@h-a-n-a h-a-n-a force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch 3 times, most recently from b43e44f to a3ce294 Compare May 11, 2026 06:19
@h-a-n-a h-a-n-a marked this pull request as ready for review May 11, 2026 06:20
@h-a-n-a h-a-n-a force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from 17e2e6c to b7ed6cb Compare May 11, 2026 06:21
@h-a-n-a h-a-n-a force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from 23aabfd to d0da050 Compare May 11, 2026 07:53
@graphite-app

graphite-app Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

Merge activity

…oxy to preserve original export names (#9132)

## Summary

When a dynamic import target ends up in a `ChunkKind::Common` chunk (shared across multiple entry boundaries), rolldown minifies all its export names. The lazy compilation fetched proxy previously did `const mod = await import(...); return mod`, passing the raw chunk namespace to user code — so `sel.foo` became `undefined` because the actual key was a short alias like `$`.

Fix: switch the fetched proxy template to use `__rolldown_runtime__.loadExports()` instead of returning the chunk namespace directly. The runtime registry stores exports with their original names, bypassing the mangled chunk-level exports.

## Test plan

Added `packages/test-dev-server/tests/playground/lazy-issue-9312`

We should probably come up with a lazy compilation test infra that makes writing multiple test cases easier.
@graphite-app graphite-app Bot force-pushed the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch from d0da050 to 07da851 Compare May 11, 2026 09:55
@graphite-app graphite-app Bot merged commit 07da851 into main May 11, 2026
32 checks passed
@graphite-app graphite-app Bot deleted the 04-16-fix_rolldown_plugin_lazy_compilation_use_loadexports_for_fetched_proxy_to_preserve_original_export_names branch May 11, 2026 09:59
@rolldown-guard rolldown-guard Bot mentioned this pull request May 13, 2026
shulaoda added a commit that referenced this pull request May 13, 2026
## [1.0.1] - 2026-05-13

### 🚀 Features

- experimental/lazy-barrel: advice on oversized barrel modules (#9236) by @shulaoda
- rolldown: inline optional-chain enum access (#9379) by @Dunqing
- chunk-optimization: dedupe already-loaded dynamic deps (#9305) by @IWANABETHATGUY
- binding: call moduleParsed hook in ParallelJsPlugin (#9318) by @jaehafe

### 🐛 Bug Fixes

- transform: enable `enum_eval` for `transformSync` and vite TS transform (#9325) by @Dunqing
- error: remove severity prefix from diagnostic messages (#9262) by @Kyujenius
- deps: pin pnpm to 10.23.0 to work around catalog mismatch on Netlify (#9364) by @shulaoda
- ci: pin mimalloc-safe to 0.1.58 (#9361) by @shulaoda
- dev/lazy: fix exports of lazy requests in lazy chunks (#9249) by @h-a-n-a
- rolldown_plugin_vite_resolve: handle errors in `resolveSubpathImports` callback (#9355) by @sapphi-red
- rolldown_plugin_lazy_compilation: use loadExports for fetched proxy to preserve original export names (#9132) by @h-a-n-a
- common: include offending index in HybridIndexVec panic message (#9296) by @SAY-5

### 🚜 Refactor

- ecmascript: extract semantic_builder_for_transform helper (#9326) by @Dunqing
- test: extract reusable static-import-cycle helper (#9332) by @IWANABETHATGUY

### 📚 Documentation

- clarify scope of `topLevelVar` (#9380) by @IWANABETHATGUY
- meta/design: add ast-mutation design doc (#9338) by @hyf0
- feat: add ai policy in contribution guide (#9315) by @mdong1909

### ⚡ Performance

- binding: enable mimalloc v3 to reduce idle memory (#9349) by @shulaoda

### 🧪 Testing

- mcs: cover require() in `$initial` group (#9376) by @hyf0
- add regression for CJS facade chunk merge into entry (#9351) by @IWANABETHATGUY

### ⚙️ Miscellaneous Tasks

- switch prepare-release to manual dispatch with version input (#9383) by @shulaoda
- migrate `@rolldown/pluginutils` to `rolldown/plugins` (#9317) by @shulaoda
- deps: pin libmimalloc-sys2 to 0.1.54 (#9372) by @shulaoda
- replace `igorskyflyer/action-readfile` with `cat` (#9369) by @sapphi-red
- deps: update test262 submodule for tests (#9371) by @rolldown-guard[bot]
- use app token for test dep update PRs (#9368) by @sapphi-red
- replace some actions with gh commands (#9367) by @sapphi-red
- replace action-semantic-pull-request with inline regex (#9366) by @sapphi-red
- remove pull_request_target workflows (#9188) by @Boshen
- deps: upgrade oxc to 0.130.0 (#9360) by @shulaoda
- deps: update github actions (major) (#9348) by @renovate[bot]
- deps: update github actions (#9341) by @renovate[bot]
- deps: update rust crates (#9344) by @renovate[bot]
- deps: update crate-ci/typos action to v1.46.1 (#9357) by @renovate[bot]
- deps: update npm packages (#9343) by @renovate[bot]
- deps: update pnpm to v10.33.4 (#9347) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to ^0.25.0 (#9346) by @renovate[bot]
- .claude: add rolldown-repl encoder, rename decode skill (#9352) by @IWANABETHATGUY
- deps: update crate-ci/typos action to v1.46.0 (#9345) by @renovate[bot]
- deps: update napi to v3.8.6 (#9342) by @renovate[bot]
- deps: update dependency vite-plus to v0.1.20 (#9340) by @renovate[bot]
- enable rollup chunking-form test (#9335) by @IWANABETHATGUY
- typo: fix typo in watcher options comment (#9324) by @thescripted

### ❤️ New Contributors

* @Kyujenius made their first contribution in [#9262](#9262)
* @SAY-5 made their first contribution in [#9296](#9296)
* @thescripted made their first contribution in [#9324](#9324)

Co-authored-by: shulaoda <[email protected]>
IWANABETHATGUY pushed a commit that referenced this pull request May 18, 2026
…oxy to preserve original export names (#9132)

## Summary

When a dynamic import target ends up in a `ChunkKind::Common` chunk (shared across multiple entry boundaries), rolldown minifies all its export names. The lazy compilation fetched proxy previously did `const mod = await import(...); return mod`, passing the raw chunk namespace to user code — so `sel.foo` became `undefined` because the actual key was a short alias like `$`.

Fix: switch the fetched proxy template to use `__rolldown_runtime__.loadExports()` instead of returning the chunk namespace directly. The runtime registry stores exports with their original names, bypassing the mangled chunk-level exports.

## Test plan

Added `packages/test-dev-server/tests/playground/lazy-issue-9312`

We should probably come up with a lazy compilation test infra that makes writing multiple test cases easier.
IWANABETHATGUY pushed a commit that referenced this pull request May 18, 2026
## [1.0.1] - 2026-05-13

### 🚀 Features

- experimental/lazy-barrel: advice on oversized barrel modules (#9236) by @shulaoda
- rolldown: inline optional-chain enum access (#9379) by @Dunqing
- chunk-optimization: dedupe already-loaded dynamic deps (#9305) by @IWANABETHATGUY
- binding: call moduleParsed hook in ParallelJsPlugin (#9318) by @jaehafe

### 🐛 Bug Fixes

- transform: enable `enum_eval` for `transformSync` and vite TS transform (#9325) by @Dunqing
- error: remove severity prefix from diagnostic messages (#9262) by @Kyujenius
- deps: pin pnpm to 10.23.0 to work around catalog mismatch on Netlify (#9364) by @shulaoda
- ci: pin mimalloc-safe to 0.1.58 (#9361) by @shulaoda
- dev/lazy: fix exports of lazy requests in lazy chunks (#9249) by @h-a-n-a
- rolldown_plugin_vite_resolve: handle errors in `resolveSubpathImports` callback (#9355) by @sapphi-red
- rolldown_plugin_lazy_compilation: use loadExports for fetched proxy to preserve original export names (#9132) by @h-a-n-a
- common: include offending index in HybridIndexVec panic message (#9296) by @SAY-5

### 🚜 Refactor

- ecmascript: extract semantic_builder_for_transform helper (#9326) by @Dunqing
- test: extract reusable static-import-cycle helper (#9332) by @IWANABETHATGUY

### 📚 Documentation

- clarify scope of `topLevelVar` (#9380) by @IWANABETHATGUY
- meta/design: add ast-mutation design doc (#9338) by @hyf0
- feat: add ai policy in contribution guide (#9315) by @mdong1909

### ⚡ Performance

- binding: enable mimalloc v3 to reduce idle memory (#9349) by @shulaoda

### 🧪 Testing

- mcs: cover require() in `$initial` group (#9376) by @hyf0
- add regression for CJS facade chunk merge into entry (#9351) by @IWANABETHATGUY

### ⚙️ Miscellaneous Tasks

- switch prepare-release to manual dispatch with version input (#9383) by @shulaoda
- migrate `@rolldown/pluginutils` to `rolldown/plugins` (#9317) by @shulaoda
- deps: pin libmimalloc-sys2 to 0.1.54 (#9372) by @shulaoda
- replace `igorskyflyer/action-readfile` with `cat` (#9369) by @sapphi-red
- deps: update test262 submodule for tests (#9371) by @rolldown-guard[bot]
- use app token for test dep update PRs (#9368) by @sapphi-red
- replace some actions with gh commands (#9367) by @sapphi-red
- replace action-semantic-pull-request with inline regex (#9366) by @sapphi-red
- remove pull_request_target workflows (#9188) by @Boshen
- deps: upgrade oxc to 0.130.0 (#9360) by @shulaoda
- deps: update github actions (major) (#9348) by @renovate[bot]
- deps: update github actions (#9341) by @renovate[bot]
- deps: update rust crates (#9344) by @renovate[bot]
- deps: update crate-ci/typos action to v1.46.1 (#9357) by @renovate[bot]
- deps: update npm packages (#9343) by @renovate[bot]
- deps: update pnpm to v10.33.4 (#9347) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to ^0.25.0 (#9346) by @renovate[bot]
- .claude: add rolldown-repl encoder, rename decode skill (#9352) by @IWANABETHATGUY
- deps: update crate-ci/typos action to v1.46.0 (#9345) by @renovate[bot]
- deps: update napi to v3.8.6 (#9342) by @renovate[bot]
- deps: update dependency vite-plus to v0.1.20 (#9340) by @renovate[bot]
- enable rollup chunking-form test (#9335) by @IWANABETHATGUY
- typo: fix typo in watcher options comment (#9324) by @thescripted

### ❤️ New Contributors

* @Kyujenius made their first contribution in [#9262](#9262)
* @SAY-5 made their first contribution in [#9296](#9296)
* @thescripted made their first contribution in [#9324](#9324)

Co-authored-by: shulaoda <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants