chore(deps): upgrade Vite to 8 (rolldown-vite)#377
Draft
RaananW wants to merge 2 commits into
Draft
Conversation
Bump vite ^6.x -> ^8.1.3 across the workspace (root, babylon-lite,
babylon-lite-compat, lab, playground). Vite 8 replaces Rollup with Rolldown
as its bundler, so this is fundamentally a Rollup -> Rolldown switch.
TypeScript is intentionally left at ^5.7.0 so this PR isolates the bundler
change; the TypeScript 6 upgrade is a separate PR. (Verified Vite 8 builds
fine under TS 5.9.3 — it does NOT require TS 6.)
Rolldown config adaptations (scripts/bundle-scenes-core.ts,
scripts/bundle-demos-core.ts, packages/babylon-lite/vite.config.ts):
- liteResolvePlugin now returns `{ id, moduleSideEffects: false }`. Rolldown
does not pick up the package's `sideEffects: false` via the resolved
absolute path, so tree-shaking of the lite entry regressed without this.
- Scene bundles use a `$initial` codeSplitting group
(`{ name: "lite-initial", tags: ["$initial"] }`) to consolidate the many
tiny util chunks Rolldown would otherwise emit back into the entry chunk,
matching Rollup's chunking.
- Lite scenes minify with Rolldown's native `oxc` minifier. terser breaks the
entry-only `__name` banner across split chunks under Rolldown, and esbuild
produces larger output; oxc is the smallest viable option.
- dist build uses `codeSplitting: false` (Rolldown's replacement for the
removed `inlineDynamicImports`) to keep the single-file dist output.
Test-harness adaptation (tests/lite/build/treeshake-rollup.test.ts):
- `normalize()` now strips Rolldown's `//#region <path>` / `//#endregion`
module-boundary comments. These are pure codegen bookkeeping, not emitted
code; without stripping them the side-effect assertions compared against
comment noise. This fixes the two false failures (source-module and
positive-control tests). See "Known residual" below for the one that
remains and is NOT masked.
Regenerated 209 per-scene bundle manifests reflecting Rolldown codegen.
Known residuals (Rolldown-inherent — documented for evaluation, NOT worked
around by touching ceilings/goldens):
- Bundle size: 5 scenes exceed their immutable maxRawKB ceilings under
Rolldown codegen — scene47 (+~0.6KB), scene49 (+~1.0KB), scene221
(+~1.3KB), scene262 (+~4.5KB), scene263 (+~4.2KB). Rolldown emits slightly
larger output than Rollup for these; the config levers above were already
applied. Merging needs either a small ceiling bump or known-diff
acceptance (user's call).
- Tree-shaking: treeshake-rollup.test.ts test 1 (bare import of the built
dist) fails because Rolldown emits the lib barrel via an `__exportAll(...)`
runtime call at module scope, which the harness's forced
`moduleSideEffects: true` treats as a module-level side effect (Rollup
emitted static `export {}` with none). This is a genuine Rolldown
tree-shakeability difference and is left visible rather than masked.
scene116 (MAD 0.288) and scene144 (0.07000434) parity failures are
PRE-EXISTING local-GPU strict-threshold noise: they fail byte-identically on
unmodified master and are green on CI. Not introduced by this change.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Bundle Size ChangesIncreases
Decreases
Sizes rounded to nearest KB. Run |
📋 parity — Test ReportBuild 20260707.12 · merge @ 395bcb9 |
…-rolldown # Conflicts: # lab/public/bundle/manifest/scene101.json # lab/public/bundle/manifest/scene102.json # lab/public/bundle/manifest/scene104.json # lab/public/bundle/manifest/scene105.json # lab/public/bundle/manifest/scene106.json # lab/public/bundle/manifest/scene110.json # lab/public/bundle/manifest/scene113.json # lab/public/bundle/manifest/scene114.json # lab/public/bundle/manifest/scene115.json # lab/public/bundle/manifest/scene128.json # lab/public/bundle/manifest/scene129.json # lab/public/bundle/manifest/scene142.json # lab/public/bundle/manifest/scene150.json # lab/public/bundle/manifest/scene151.json # lab/public/bundle/manifest/scene155.json # lab/public/bundle/manifest/scene170.json # lab/public/bundle/manifest/scene172.json # lab/public/bundle/manifest/scene18.json # lab/public/bundle/manifest/scene201.json # lab/public/bundle/manifest/scene202.json # lab/public/bundle/manifest/scene203.json # lab/public/bundle/manifest/scene205.json # lab/public/bundle/manifest/scene213.json # lab/public/bundle/manifest/scene221.json # lab/public/bundle/manifest/scene222.json # lab/public/bundle/manifest/scene223.json # lab/public/bundle/manifest/scene224.json # lab/public/bundle/manifest/scene225.json # lab/public/bundle/manifest/scene3.json # lab/public/bundle/manifest/scene36.json # lab/public/bundle/manifest/scene45.json # lab/public/bundle/manifest/scene46.json # lab/public/bundle/manifest/scene49.json # lab/public/bundle/manifest/scene53.json # lab/public/bundle/manifest/scene54.json # lab/public/bundle/manifest/scene57.json # lab/public/bundle/manifest/scene59.json # lab/public/bundle/manifest/scene66.json # lab/public/bundle/manifest/scene94.json # lab/public/bundle/manifest/scene95.json # lab/public/bundle/manifest/scene98.json # package.json # pnpm-lock.yaml
Bundle Size ChangesIncreases
Decreases
Sizes rounded to nearest KB. Run |
RaananW
added a commit
that referenced
this pull request
Jul 9, 2026
## Scope Bumps **TypeScript `^5.7.0` → `^6.0.3`** across the workspace only. **Vite is unchanged** (stays at its existing `^6.x` pins). This PR was originally TS6 + Vite 8 together, but a split diagnostic showed the two majors carry independent risk, so the Vite 8 (rolldown-vite) work has been moved to its **own separate draft PR (#377, parked as exploration)**. This PR is now a clean, zero-ceiling/zero-golden TypeScript-6-only change and is **the deliverable**. ### Version bumps `typescript ^5.7.0 → ^6.0.3` in: root, `packages/babylon-lite`, `packages/babylon-lite-gl`, `packages/babylon-lite-compat`, `lab`, `playground`. `pnpm-lock.yaml` regenerated (TS-only delta; resolves TS `5.9.3 → 6.0.3`). ## Code changes required by TS 6 - **`packages/babylon-lite/src/material/node/node-geometry-renderable.ts`** — copy the readonly `_vertexBuffers` array (`buffers: [...a._vertexBuffers]`) when passing it as `GPUVertexState.buffers`. TS6 tightened the WebGPU typings so a readonly array is no longer assignable to the mutable `buffers` field. Semantics-preserving (shallow copy only; no runtime/render change). - **`tests/lite/build/public-api-types.test.ts`, `tests/gl/build/public-api.test.ts`** — add `--ignoreConfig` to the standalone `tsc` invocations. TS6 now errors (**TS5112**) when a file is passed on the command line while a `tsconfig.json` exists in cwd; `--ignoreConfig` is the flag the error itself recommends. - **`tests/lite/build/public-api-types.test.ts`** — drop `--types @webgpu/types`. TS6's built-in `dom` lib now bundles the WebGPU declarations, so also loading the `@webgpu/types` package duplicates them and (without `skipLibCheck`, which this test deliberately omits to catch leaking internal types) trips **TS6200/TS2717** conflicts. The native lib fully covers every `GPU*` type the public `build/index.d.ts` references — verified type-checks clean. No tsconfig strictness was loosened; no blanket `any` / `@ts-ignore` was added. ### Bundle manifests All per-scene bundle manifests were regenerated under TS6. Codegen is **byte-identical to the TS5/Rollup baseline for every scene except two** — `scene104.json` and `scene149.json` — which shift by a fraction of a KB (gzip rounding, e.g. `44.5 → 44.6` KB). Those two are therefore the only manifest files this PR changes vs `master`, and both remain within existing size ceilings (**0 overages**). (An earlier revision of this description said "46 manifests"; that reflected a mid-work snapshot before the TS6-only split — the accurate figure vs `master` is 2.) ## Test / build results (TS6 + Vite 6) - `pnpm run lint` (eslint + `tsc --noEmit` across all tsconfigs): ✅ green - `pnpm test:unit` ✅ · `pnpm test:build` ✅ · `pnpm test:unit:gl` ✅ · `pnpm test:build:gl` ✅ - `pnpm build:lib`, `pnpm build`, `pnpm build:gl`, `pnpm build:playground`: ✅ exit 0 - Locked parity + bundle-size on `LAB_TEST_PORT=5279`: **0 bundle-size overages** ✅. Only `scene116` parity fails (see below); `scene144` now **passes** after merging master's widened `0.072` ceiling (#380). ### scene116 is pre-existing local-GPU noise — NOT introduced here `scene116` fails **byte-identically on unmodified `master`** (TS 5.9.3 + Vite 6, this branch's changes reverted): MAD `0.2883984375…` vs threshold `0.01`. It is machine/GPU-specific strict-threshold noise that is **green on CI**, and fails with and without this PR's changes, so it is not a regression from the TS6 upgrade — a reviewer should not be alarmed. `scene144` (`0.07000434…`) previously sat a hair over the old `0.07` threshold but now **passes** under master's widened `0.072` ceiling (#380). No golden references or thresholds were touched. ## Notes - Touches `pnpm-lock.yaml` → shares a conflict surface with sibling dependency PRs (#374 and the parked Vite 8 PR #377); **whichever merges second regenerates the lock** (trivial re-resolve). - Merged current `master` (incl. #374 tooling batch + pnpm 9.15.9, #378 REUSE_BROWSER, #353, #381); all suites re-validated green. - Kept as **draft** for the user's review (drafts-first). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Scope
Bumps Vite
^6.x→^8.1.3across the workspace (root,packages/babylon-lite,packages/babylon-lite-compat,lab,playground). Vite 8 swaps Rollup for Rolldown as its bundler, so this PR is fundamentally a Rollup → Rolldown switch.TypeScript is intentionally left at
^5.7.0so this PR isolates the bundler change — the TypeScript 6 upgrade is a separate PR. Verified: Vite 8 builds cleanly under TS 5.9.3; it does not require TS 6, so the two upgrades are independent.This split was made deliberately so the Rolldown switch can be evaluated on its own merits — it carries real, quantifiable costs (below) that the TS6 PR does not.
🔄 Refreshed against current
masterMerged
origin/master(now includes #374 tooling batch + pnpm 9.15.9, #378REUSE_BROWSER, #369 viewer support, #379 docs, #380 scene144 ceiling widen). Lock regenerated cleanly (pnpm install), test-harness files (playwright.config.ts,parity-fixtures.ts,compare-core.ts) taken from master, Rolldown config kept invite.config/bundle scripts. All 209 per-scene manifests regenerated with Rolldown against the new baseline. The size story is unchanged by the merge — same 5 scenes over ceiling, ~3.3 KB total.Rolldown config adaptations
liteResolvePlugin(scripts/bundle-scenes-core.ts,scripts/bundle-demos-core.ts) now returns{ id, moduleSideEffects: false }. Rolldown doesn't pick up the package'ssideEffects: falsevia the resolved absolute path, so the lite entry stopped tree-shaking without this.$initialcodeSplitting group ({ name: "lite-initial", tags: ["$initial"] }) consolidates the many tiny util chunks Rolldown would otherwise emit back into the entry chunk, matching Rollup's chunking.oxcminifier for lite scenes — Rolldown's native minifier. terser breaks the entry-only__namebanner across split chunks under Rolldown; esbuild produces larger output; oxc is the smallest viable option.codeSplitting: falsein the distvite.config.ts— Rolldown's replacement for the removedinlineDynamicImports, keeping the single-file dist output.Test-harness adaptation
tests/lite/build/treeshake-rollup.test.ts→normalize()now strips Rolldown's//#region <path>///#endregionmodule-boundary comments (pure codegen bookkeeping, not emitted code). Without this, the side-effect assertions compared against comment noise. This fixes two false failures (the "every source module" test and the positive control). The remaining failure is not masked — see residuals.Bundle-size result vs current
master(refreshed)bundle-size.spec.tsunder the parity lock (port 5279): 202 passed, 5 failed — the same 5 Rolldown overages, no new scenes:~3.3 KB total over — identical set to the pre-merge measurement. No ceilings or goldens touched.
Parity vs current
mastermaxMadto 0.072; Rolldown build measures within it. ✅master, green on CI. Not introduced here.REUSE_BROWSER=true --workers=1(headed) confirmed working on the scene specs.Test / build results
pnpm run lint(eslint + tsc across all tsconfigs): ✅ greenpnpm build:lib: ✅ exit 0pnpm test:build:These are the reason this PR is separate and parked. No ceilings or golden references were touched.
1. Bundle-size ceiling overages (5 scenes) — table above; Rolldown emits slightly larger output than Rollup even with the config levers applied.
2. Tree-shakeability —
treeshake-rollup.test.tstest 1 (bare import of the built dist) still fails after the master merge: Rolldown emits the lib barrel via an__exportAll(...)runtime call at module scope, which the harness's forcedmoduleSideEffects: truetreats as a module-level side effect (Rollup emitted staticexport {}with none). This is a genuine Rolldown tree-shakeability difference vs GUIDANCE's "zero module-level side effects" pillar and is left visible rather than masked for evaluation.Notes
pnpm-lock.yaml→ shares a conflict surface with the TS6 PR chore(deps): upgrade TypeScript to 6 #376 and chore(deps): safe tooling batch + pnpm 9.15.9 #374; whichever merges second regenerates the lock.