Skip to content

fix(bundled-dev): serve the rolldown runtime from the installed rolldown - #23568

Merged
sapphi-red merged 3 commits into
mainfrom
feat/bundled-dev-serve-rolldown-runtime
Sep 25, 2026
Merged

sapphi-red merged 3 commits into
mainfrom
feat/bundled-dev-serve-rolldown-runtime

Conversation

@h-a-n-a

@h-a-n-a h-a-n-a commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Fixes the problem in rolldown/rolldown#10982

This PR serves Rolldown runtime with the installed one, so as to fix the runtime inconsistency between Rolldown and VIte, given that Rolldown's version is not locked in Vite.

closes #23547

Comment thread packages/vite/src/node/plugins/clientInjections.ts Outdated
Comment on lines +186 to +193
for (const name of fs.readdirSync(dir)) {
if (name.startsWith('experimental-runtime') && name.endsWith('.mjs')) {
files.set(
`${BUNDLED_DEV_ROLLDOWN_RUNTIME_DIR}/${name}`,
fs.readFileSync(path.join(dir, name), 'utf-8'),
)
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[Non blocking] Relying on the file name feels difficult to ensure. Maybe we should be bundling to a single file. That would also reduce the number of requests needed.

@h-a-n-a h-a-n-a Sep 25, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed that we should bundle it in Rolldown. Based on that, Vite side should only be relying on a single runtime file exported by Rolldown. However, this should be released in minor Vite and minor Rolldown, otherwise it will again break the runtime, causing some runtime modules are not served and thus imported correctly, given the runtime was bundled at Vite build time.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yep, let's do it in a minor.

@sapphi-red
sapphi-red merged commit bc598a6 into main Sep 25, 2026
39 of 41 checks passed
@sapphi-red
sapphi-red deleted the feat/bundled-dev-serve-rolldown-runtime branch September 25, 2026 08:08
graphite-app Bot pushed a commit to rolldown/rolldown that referenced this pull request Sep 25, 2026
<!--
- 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!
-->

Harden the contract in vitejs/vite#23568, so as to keep `experimental-runtime*` files exported.
graphite-app Bot pushed a commit to rolldown/rolldown that referenced this pull request Sep 28, 2026
<!--
- 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!
-->

Resolves vitejs/vite#23568 (comment)

Merging this will not break Vite, given Vite now bundles `DevRuntime` into their own client when Vite is built and vitejs/vite#23587 will only be released in Vite minor.
stipsan added a commit to sanity-io/plugins that referenced this pull request Sep 28, 2026
…2.9 (#2034)

<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
### Description

Ports
[sanity-io/sanity#15055](sanity-io/sanity#15055)
to this repo. `dev/test-studio` runs `sanity dev` with
`unstable_bundledDev: true`, so it has the same exposure.

Vite 8.3.1 inlines rolldown 1.2.9's browser dev runtime into
`bundledDevClient.mjs`, but declares `rolldown: ~1.2.9`. rolldown 1.2.10
dropped the `kind` argument from `registerFactory`
([rolldown#10915](rolldown/rolldown#10915)).
With rolldown 1.2.10 or 1.2.11 under Vite 8.3.1, every lazy `import()`
and HMR update in bundled dev fails with `TypeError: factory.fn is not a
function`.

This PR bumps Vite from 8.2.2 to 8.3.1 and adds a `vite@8.3.1>rolldown:
1.2.9` override. The pin is scoped to 8.3.1 because the next Vite
release serves the runtime from the installed rolldown
([vite#23568](vitejs/vite#23568)). Delete it
when bumping past 8.3.1.

_Testing in progress; description will be updated with results._
<!-- CURSOR_AGENT_PR_BODY_END -->

<div><a
href="https://cursor.com/agents/bc-8a49abed-56bd-47f4-9e16-fbcde27d80eb?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
href="https://cursor.com/background-agent?bcId=bc-8a49abed-56bd-47f4-9e16-fbcde27d80eb&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cody Olsen <stipsan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Every dynamic import fails under experimental.bundledDev with vite 8.3.0 + rolldown 1.2.9: __rolldown_runtime__.requestLazy is not a function

2 participants