Skip to content

perf(dev/lazy): fetch a lazy route in one request - #10789

Merged
graphite-app[bot] merged 1 commit into
mainfrom
08-27-perf_dev_fetch_a_lazy_route_in_one_request
Sep 14, 2026
Merged

graphite-app[bot] merged 1 commit into
mainfrom
08-27-perf_dev_fetch_a_lazy_route_in_one_request

Conversation

@h-a-n-a

@h-a-n-a h-a-n-a commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

A lazy import() in dev now costs one network request instead of two.

Before, the dev build turned a lazy boundary into its own chunk. The browser first fetched that proxy chunk, whose body then fetched the real module through /@vite/lazy. After that, a second promise chain ('rolldown:exports') handed the exports back to the importer.

before:  import('./route')
           -> GET /assets/route-proxy.js        (proxy chunk)
           -> GET /@vite/lazy?id=...            (real module)
           -> loadExports(proxyId)['rolldown:exports']

after:   import('./route')
           -> __rolldown_runtime__.requestLazy('route.js', () => import('/@vite/lazy?id=...'))
           -> GET /@vite/lazy?id=...            (real module, the only request)
           -> initModule('route.js')

Now the finalizer rewrites a lazy import() into a single runtime call. The proxy module still exists as a graph node, but its body is empty and is never executed, so no chunk is emitted for it.

h-a-n-a commented Aug 27, 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 Aug 27, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 7f44e14
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6aa7b519b60e9e0008f39650

@h-a-n-a h-a-n-a changed the title perf(dev): fetch a lazy route in one request perf(dev/lazy): fetch a lazy route in one request Aug 27, 2026
@h-a-n-a
h-a-n-a changed the base branch from main to graphite-base/10789 September 10, 2026 09:02
@h-a-n-a
h-a-n-a force-pushed the 08-27-perf_dev_fetch_a_lazy_route_in_one_request branch from ee4410a to bf70951 Compare September 10, 2026 09:03
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://08-27-perf-dev-fetch-a-lazy-route-in-one-request-rolldown-rs.voidzero-docs.workers.dev (commit 7f44e14)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://67de13bf-rolldown-rs.voidzero-docs.workers.dev 7f44e14 2026-09-14T08:52:14.573Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://638d6112-rolldown-rs.voidzero-docs.workers.dev db96167 2026-09-14T08:01:30.119Z Visit the dashboard ↗
  • Build: In progress 🔵

View logs ↗
1b9cc69 2026-09-14T07:58:43.946Z View logs ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://582fdbb5-rolldown-rs.voidzero-docs.workers.dev fc86df9 2026-09-14T07:32:20.485Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://99acade2-rolldown-rs.voidzero-docs.workers.dev 9abe27e 2026-09-11T04:37:23.716Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://0fa3e3e5-rolldown-rs.voidzero-docs.workers.dev bf70951 2026-09-10T09:05:32.728Z Visit the dashboard ↗

@h-a-n-a
h-a-n-a changed the base branch from graphite-base/10789 to fix/setup-vite-link-before-build September 10, 2026 09:03
@h-a-n-a
h-a-n-a marked this pull request as ready for review September 10, 2026 12:12
@codspeed

codspeed Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 7 untouched benchmarks
⏩ 10 skipped benchmarks1


Comparing 08-27-perf_dev_fetch_a_lazy_route_in_one_request (db96167) with main (a1ac2f8)2

Open in CodSpeed

Footnotes

  1. 10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (096569f) during the generation of this report, so a1ac2f8 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf709510ea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/rolldown/src/hmr/utils.rs Outdated
@h-a-n-a
h-a-n-a force-pushed the 08-27-perf_dev_fetch_a_lazy_route_in_one_request branch from 9abe27e to fc86df9 Compare September 14, 2026 07:29
@graphite-app
graphite-app Bot changed the base branch from fix/setup-vite-link-before-build to graphite-base/10789 September 14, 2026 07:52
@graphite-app
graphite-app Bot force-pushed the 08-27-perf_dev_fetch_a_lazy_route_in_one_request branch from fc86df9 to 1b9cc69 Compare September 14, 2026 07:58
@graphite-app
graphite-app Bot force-pushed the graphite-base/10789 branch from 4ff97a8 to 096569f Compare September 14, 2026 07:58
@graphite-app
graphite-app Bot changed the base branch from graphite-base/10789 to main September 14, 2026 07:59
@graphite-app
graphite-app Bot force-pushed the 08-27-perf_dev_fetch_a_lazy_route_in_one_request branch from 1b9cc69 to db96167 Compare September 14, 2026 07:59

h-a-n-a commented Sep 14, 2026 •

Copy link
Copy Markdown
Member Author

Merge activity

  • Sep 14, 8:49 AM UTC: The merge label 'graphite: merge-when-ready' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 14, 8:49 AM UTC: h-a-n-a added this pull request to the Graphite merge queue.
  • Sep 14, 8:56 AM UTC: Merged by the Graphite merge queue.

<!--
- What is this PR solving? Write a clear and concise description.
- Reference the issues it solves (e.g. `fixes #123`).
- What other alternatives have you explored?
- Are there any parts you think require more attention from reviewers?

Also, please make sure you do the following:

- Read the Contributing Guidelines at https://rolldown.rs/contribution-guide/.
- Check that there isn't already a PR that solves the problem the same way. If you find a duplicate, please help us review it.
- Update the corresponding documentation if needed.
- Include relevant tests that fail without this PR but pass with it. If the tests are not included, explain why.

Thank you for contributing to Rolldown!
-->

A lazy `import()` in dev now costs **one** network request instead of two.

Before, the dev build turned a lazy boundary into its own chunk. The browser first fetched that proxy chunk, whose body then fetched the real module through `/@vite/lazy`. After that, a second promise chain (`'rolldown:exports'`) handed the exports back to the importer.

```
before:  import('./route')
           -> GET /assets/route-proxy.js        (proxy chunk)
           -> GET /@vite/lazy?id=...            (real module)
           -> loadExports(proxyId)['rolldown:exports']

after:   import('./route')
           -> __rolldown_runtime__.requestLazy('route.js', () => import('/@vite/lazy?id=...'))
           -> GET /@vite/lazy?id=...            (real module, the only request)
           -> initModule('route.js')
```

Now the finalizer rewrites a lazy `import()` into a single runtime call. The proxy module still exists as a graph node, but its body is empty and is never executed, so no chunk is emitted for it.
@graphite-app
graphite-app Bot force-pushed the 08-27-perf_dev_fetch_a_lazy_route_in_one_request branch from db96167 to 7f44e14 Compare September 14, 2026 08:49
@graphite-app
graphite-app Bot merged commit 7f44e14 into main Sep 14, 2026
37 checks passed
@graphite-app
graphite-app Bot deleted the 08-27-perf_dev_fetch_a_lazy_route_in_one_request branch September 14, 2026 08:56
@rolldown-guard rolldown-guard Bot mentioned this pull request Sep 16, 2026
shulaoda added a commit that referenced this pull request Sep 16, 2026
## [1.2.9] - 2026-09-16

### 🚀 Features

- add `MODULE_LEVEL_DIRECTIVE` warning (#10791) by @sapphi-red

### 🐛 Bug Fixes

- handle CommonJS exports through top-level `this` (#10872) by @IWANABETHATGUY
- scripts: make setup-vite CLI invocation work on Windows (#10885) by @shulaoda
- remove deleted property from output bundle proxy target (#10815) by @Vladexy88x
- treat module-scope `await using` as top-level await (#10739) by @MarshallOfSound
- watch: preserve plugin attribution in warnings (#10473) by @Nic-Polumeyv
- test-dev-server: link the workspace rolldown before building vite (#10857) by @h-a-n-a
- minify: preserve annotation comments when minified (#10854) (#10855) by @justonemorenight

### ⚡ Performance

- dev/lazy: fetch a lazy route in one request (#10789) by @h-a-n-a
- plugin: reduce binding binary size (#10776) by @Boshen
- vite-reporter: reuse emitted sourcemap sizes (#10841) by @hyfdev

### 🧪 Testing

- dev: full-bundle-mode regression test for cyclic import binding (#9946) (#9947) by @ShMcK
- cover asset option callback timings (#10870) by @IWANABETHATGUY

### ⚙️ Miscellaneous Tasks

- wait for npm bindings before publishing rolldown (#10866) by @shulaoda
- deps: update dependency @napi-rs/cli to v3.10.1 (#10889) by @renovate[bot]
- deps: update napi (#10888) by @renovate[bot]
- compress debug info archives with zstd (#10778) by @IWANABETHATGUY
- publish split debug info for release bindings (#10777) by @IWANABETHATGUY
- rolldown_utils: simplify MIME guessing and remove UTF-8 check bypass (#10884) by @shulaoda
- add npm bugs metadata for rolldown (#9694) by @kingshuaishuai
- deps: upgrade oxc to 0.150.0 (#10877) by @camc314
- deps: update rust crates (#10869) by @renovate[bot]
- deps: update dependency vite-plus to v0.3.2 (#10878) by @renovate[bot]
- deps: update rollup submodule for tests to v4.63.3 (#10880) by @rolldown-guard[bot]
- deps: update test262 submodule for tests (#10881) by @rolldown-guard[bot]
- deps: update github actions (#10867) by @renovate[bot]
- deps: update npm packages (#10868) by @renovate[bot]
- deps: update napi to v3.12.4 (#10862) by @renovate[bot]
- deps: update napi (#10861) by @renovate[bot]

### ❤️ New Contributors

* @Vladexy88x made their first contribution in [#10815](#10815)
* @MarshallOfSound made their first contribution in [#10739](#10739)
* @kingshuaishuai made their first contribution in [#9694](#9694)
* @ShMcK made their first contribution in [#9947](#9947)
* @justonemorenight made their first contribution in [#10855](#10855)

Co-authored-by: shulaoda <165626830+shulaoda@users.noreply.github.com>
graphite-app Bot pushed a commit that referenced this pull request Sep 24, 2026
…10982)

<!--
- What is this PR solving? Write a clear and concise description.
- Reference the issues it solves (e.g. `fixes #123`).
- What other alternatives have you explored?
- Are there any parts you think require more attention from reviewers?

Also, please make sure you do the following:

- Read the Contributing Guidelines at https://rolldown.rs/contribution-guide/.
- Check that there isn't already a PR that solves the problem the same way. If you find a duplicate, please help us review it.
- Update the corresponding documentation if needed.
- Include relevant tests that fail without this PR but pass with it. If the tests are not included, explain why.

Thank you for contributing to Rolldown!
-->

Revert to fix vitejs/vite#23547.

This PR will be reverted again once the fix on Vite has landed.
graphite-app Bot pushed a commit that referenced this pull request Sep 24, 2026
…10982)

<!--
- What is this PR solving? Write a clear and concise description.
- Reference the issues it solves (e.g. `fixes #123`).
- What other alternatives have you explored?
- Are there any parts you think require more attention from reviewers?

Also, please make sure you do the following:

- Read the Contributing Guidelines at https://rolldown.rs/contribution-guide/.
- Check that there isn't already a PR that solves the problem the same way. If you find a duplicate, please help us review it.
- Update the corresponding documentation if needed.
- Include relevant tests that fail without this PR but pass with it. If the tests are not included, explain why.

Thank you for contributing to Rolldown!
-->

Revert to fix vitejs/vite#23547.

This PR will be reverted again once the fix on Vite has landed.
@rolldown-guard rolldown-guard Bot mentioned this pull request Sep 24, 2026
shulaoda added a commit that referenced this pull request Sep 24, 2026
## [1.2.11] - 2026-09-24

### 🚀 Features

- watch: report only file events (#10974) by @shulaoda

### 🐛 Bug Fixes

- sourcemap: preserve names through `collapse_sourcemaps` (#9486) by @eoin
- watch: map metadata events by kind and missing paths as deleted (#10973) by @shulaoda

### 🚜 Refactor

- rolldown_fs_watcher: hand the handler file events instead of notify results (#10980) by @shulaoda
- rolldown_fs_watcher: share one event handler adapter between the notify watchers (#10979) by @shulaoda
- rolldown_fs_watcher: register every path with one watch mode (#10978) by @shulaoda
- rolldown_fs_watcher: tweak the backend traits and the event mapping (#10977) by @shulaoda
- watch: translate notify events inside FsWatcher (#10972) by @shulaoda

### 📚 Documentation

- watch: update the fs watcher layout and the dev coordinator message (#10981) by @shulaoda
- watch: document the event translation in FsWatcher (#10975) by @shulaoda

### ◀️ Revert

- "perf(dev/lazy): fetch a lazy route in one request" (#10789) (#10982) by @h-a-n-a

### ❤️ New Contributors

* @eoin made their first contribution in [#9486](#9486)

Co-authored-by: shulaoda <165626830+shulaoda@users.noreply.github.com>

This branch had an error being deployed

1 failed deployment
crates — 7f44e144 Deployed Sep 14, 2026 by graphite-app[bot] via Release crates #24
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