Vite 8.1 + Rolldown 1.1.2 upgrade, with experimental bundled dev mode (off by default)#730
Open
natew wants to merge 3 commits into
Open
Vite 8.1 + Rolldown 1.1.2 upgrade, with experimental bundled dev mode (off by default)#730natew wants to merge 3 commits into
natew wants to merge 3 commits into
Conversation
pin lazyBarrel off in prod native build (rolldown 1.1 flipped the default) Agentbus-Session: ab-mqqwiegt-38564
…ation) Agentbus-Session: ab-mqqwiegt-38564
…ndleDev) Agentbus-Session: ab-mqrcxyt6-19898
|
🚅 Deployed to the one-pr-730 environment in onestack.dev
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades One to Vite 8.1.0 + Rolldown 1.1.2, and adds an experimental bundled dev mode (Vite's
FullBundleDevEnvironment) behind an opt-in flag:The upgrade itself (normal/unbundled dev + prod builds) is the shippable win. Bundled dev mode is wired up and renders/hydrates, but has known upstream blockers documented below — it's off by default and should stay that way until those land.
Why upgrade (independent of bundled mode)
Vite 8's headline is Rolldown becoming the single Rust bundler (replaces Rollup + esbuild):
@vitejs/plugin-reactv6)Normal dev is unchanged vs Vite 7, so the build-side win lands regardless of dev mode.
Bundled dev mode — what it is
A single rolldown-powered client bundle in dev instead of unbundled ESM (~4× fewer requests). Four One-specific problems had to be solved to make it work (asset-import inlining,
lazyBarreloff,shimMissingExports, react-refresh preamble) — seenotes/vite-8.1-bundleddev-findings.mdandbundledDevPlugin.ts. All new code paths are gated on the flag; normal dev is unaffected.Verified: homepage + routes render & hydrate, client
<Link>nav + browser back/forward work, 0 console errors (one-basic + tamagui.dev, cold + warm).All three live in the vite / rolldown bundled-dev substrate, not One, and none affect prod builds —
bundledDevPluginis gated oncommand === 'serve', so production output is untouched.1. HMR is broken and crashes the dev server (blocker) — upstream Vite 8.1.0 bug
Live-tested (playwright, edit a file, browser connected, no reload): the edit (a) never applies to the DOM — Fast Refresh is dead — and (b) crashes the whole dev server seconds later with
RangeError: Maximum call stack size exceeded(exit 7). Root cause is stock vite 8.1.0DevEnvironment.invalidateModule:Confirmed contrast: normal (unbundled) dev on this same branch applies edits and the server stays up (Fast Refresh works, 0 errors); with no browser attached the edit doesn't crash (the crash needs a connected client to send the invalidate). Needs an upstream vite fix (or a local
patch-package) before bundled dev is daily-usable.2.
matchMedia"Illegal invocation" on cold load — rolldown interop codegen@tamagui/web'smatchMediahelper re-exports the unbound nativewindow.matchMedia. Rolldown's bundled-dev interop compiles the call asns.matchMedia(q)(this= module namespace) instead of the detached(0, ns.matchMedia)(q)form normal bundlers emit, so native matchMedia throws. Worked around in tamagui withwindow.matchMedia?.bind(window)(defensive, harmless, worth upstreaming) — but it's a symptom: anyconst fn = window.nativeThingre-export trips the same bug. Not needed for normal dev / prod builds.3.
__toCommonJS(undefined)cold race on heavily-lazy-split routes — rolldown runtime/takeout'sReact.lazy3D box throws on cold first load from the generated rolldown runtime (CJS dep referenced before init across concurrently-loading lazy blobs); self-recovers on reload. Low severity, cold-only.Recommendation
Land the Vite 8.1 / Rolldown upgrade for the build-side gains. Keep
experimentalBundledDevoff by default until at least the upstream viteinvalidateModulerecursion is fixed. One pre-merge validation still worth doing: a Rolldown prod-build smoke test (the matchMedia-class interop could surface invite build— untested so far).Files
packages/one/src/vite/plugins/bundledDevPlugin.ts(new) — asset inliner + bundled clientrolldownOptionspackages/one/src/vite/one.ts,types.ts— wire the flagvirtualEntryPlugin.ts,fileSystemRouterPlugin.tsx,devtoolsPlugin.ts— refresh preamble / preload / devtools fixes (all gated on the flag)examples/one-basic/vite.config.ts— demonstrates the flag viaBUNDLED_DEVenvnotes/vite-8.1-bundleddev-findings.md— full writeup