Skip to content

refactor(compiler)!: replace Babel with a Yuku-based compiler core for Router and Start - #8817

Draft
Sheraff wants to merge 3670 commits into
mainfrom
compiler-rewrite/yuku
Draft

Sheraff wants to merge 3670 commits into
mainfrom
compiler-rewrite/yuku

Conversation

@Sheraff

@Sheraff Sheraff commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Includes the oracle test-suite branch compiler-tests/baseline. That branch adds the oracle (packages/compiler-test-utils) and pins main's bugs as .fails. This PR replaces the compilers and turns the pins green.

Summary

Every TanStack build-time compiler now runs on one shared core built on Yuku. That covers route code splitting and route HMR (router-plugin), all of Start's transforms (server functions, environment separation, <Hydrate>, RSC CSS, import protection) and the route generator. Babel, babel-dead-code-elimination and the Prettier hot path are gone.

Guaranteed against main

  • Route splitting does what main does. Wherever main's output builds and runs correctly, ours does too, with the same runtime behaviour (the same options split, one instance where main has one, code run once where main runs it once) and no more client bytes. Where main fails to compile a route, it builds and works here. The exceptions are listed under Behaviour changes, and the byte differences on the corpus under Testing.
  • Server code. The guarantee is about the primitives: server functions and Start builders, import protection, .server files and markers, and the route options a client build removes. Each use of a Start builder or factory is either compiled or fails the client build at that use, so a shape the compiler can't follow doesn't ship silently. What this doesn't cover is under Not guaranteed.
  • One plan per module. Each module gets one plan per environment and config. Router-only apps parse a module once per environment; under Start, the raw read that cross-module summaries need adds one parse. Outputs don't depend on transform or request order, and source maps are exact.

Headline numbers (tables under Performance)

  • Builds are 2.2–4.8× faster and dev cold start is 2.2–4.9× faster, on 333- and 1,485-route React and Solid apps.
  • HMR: route component edits are −16…−53% on Vite and −29% / −39% on Rsbuild. Server fn edits are −39…−79%.
  • Memory: Start builds end with 3–11× less heap.
  • Slower than main in a few measured places, each listed with its number and cause under Losses.

Checked by the oracle (known-bug pins drop from 874 to 55, all listed below), differential gates against main on a 58,075-compile corpus, a leak canary over 139 app builds, and the e2e suites. 27 issues are closed: 23 are fixed here, and 4 that main already handles get their tests here.

Parts of this PR have landed on main as separate PRs (#8849, #8851, #8852, #8853, #8855, #8856, #8857, #8858, #8860, #8861, #8863, #8866, #8867, #8868, #8869, #8870, #8871, #8876 and the visible() fix #8653). This branch is merged with them, and their changes aren't described again here.

Contents

section what is in it
Architecture the pipeline in one diagram, each step in plain terms
Performance headline tables, HMR by edit kind, memory, losses
Testing the oracle, the final gates, known flakes
Remaining fail pins (55) what still fails, by reason
Behaviour changes different from main · better than main · not guaranteed
Follow-ups work kept out of this PR
Upstream issues filed Yuku, Vite, Rolldown, Rspack, Rsbuild, SWC, solid-refresh, chokidar, others
Issues closed, superseded and obsolete issues and PRs
How to review reading order through the code

Upgrading an app: read Different from main, accepted. Reviewing the code: read Architecture, then How to review.

Architecture

One compile of one module, from its text to its outputs. Full map: packages/router-utils/src/compiler/README.md.

flowchart TD
  src["Module text<br/>(one environment, one config)"] --> parse["Parse once with Yuku"]
  parse --> analysis["Shared analysis<br/>top-level units, bindings, references"]
  raw["Imported modules<br/>(raw text, never the bundler's pipeline)"] --> summaries["Summaries<br/>what each export is"]
  analysis --> planners
  summaries --> planners
  subgraph planners["Planners: each adds edits and roots to one shared plan"]
    direction LR
    p1["start-env<br/>server fns, middleware,<br/>env-only code"] --> p2["hydrate<br/>Hydrate boundaries"] --> p3["rsc-css<br/>RSC CSS"] --> p4["router<br/>route splitting,<br/>deleteNodes, HMR"] --> p5["import-edges<br/>import protection"]
  end
  planners --> placement["One placement<br/>what each output holds, imports and copies"]
  placement -. "an output would assign a binding it imports:<br/>that code stays in place, the planners run again" .-> planners
  placement --> plan["Frozen plan<br/>plain data"]
  plan --> policy["Edge policies, per output<br/>import protection: verdicts, mocks, diagnostics"]
  policy --> publish[("Published: cached per environment, module and config<br/>only if no newer save of the file superseded this compile")]
  publish --> facts["Facts<br/>import edges, server-fn registry,<br/>diagnostics, dependencies"]
  publish --> emit["Emit: rewrite on the original source ranges<br/>exact source maps, user code never re-printed"]
  emit --> o1["Env module<br/>(the route module)"]
  emit --> o2["Split chunks<br/>?tsr-split=…"]
  emit --> o3["Shared module<br/>?tsr-split=shared---…"]
  emit --> o4["Server-fn modules<br/>?tss-serverfn-handler<br/>?tss-serverfn-split"]
  emit --> o5["Hydrate chunks<br/>?tss-hydrate=…"]
Loading

The boxes, top to bottom:

  1. Parse and analyse once. Each (env, module, config, text) gets one analysis and one plan. No job parses again, prints code again or reads another job's output.
  2. Summaries. What an imported module exports is read from its raw text, never from the bundler pipeline. APIs are recognised by binding, through an abstract value domain, never by name.
  3. Planners are the jobs (table below). Each one adds edits and roots to the shared plan, in a fixed order: start-env → hydrate → rsc-css → router → import-edges. The router plugin alone runs only router. One recogniser (routeCallOf, router-generator) decides what a route file is, for the generator and the router planner, and the planner acts only on files the generator lists.
  4. One placement (placement.ts) serves every plan: route files, server-fn handler modules, the RSC provider copy, <Hydrate> chunks and every plan that only erases code. Its rules are closed: they follow names, references and assignments, and never ask what code does (whether it is pure, or what it writes). Purity is only import protection's effect model.
  5. The plan is frozen into plain data. It emits the env module, its derived modules (?tsr-split=…, ?tss-hydrate=…, ?tss-serverfn-split, ?tss-serverfn-handler) and facts (import edges, server-fn registry, diagnostics, dependencies). Any id of a file may be requested first.
  6. Edge policies run on the frozen plan, one output at a time: import protection reads each output's import edges, may swap a specifier for its mock and adds diagnostics.
  7. Publication. The plan is cached, and Start's server-fn registry updated from it, only if no newer save of the file superseded the compile while it waited (a slow resolution in dev). A superseded compile still answers its request.
  8. Emit builds a rewrite tree over the original source ranges, so user code is never re-printed. OutputBuilder writes VLQ maps directly and composes them with input maps.
planner job code
start-env server functions, middleware, isomorphic and env-only fns, <ClientOnly> start-plugin-core/src/planners/start-env.ts
hydrate <Hydrate> children extracted into chunks start-plugin-core/src/planners/hydrate.ts
rsc-css RSC CSS injection in the provider environment start-plugin-core/src/planners/rsc-css.ts
router route option splitting, deleteNodes, route HMR router-plugin/src/planners/router.ts
import-edges import protection: the import edges of each output, mock substitution start-plugin-core/src/planners/edges.ts

Where to start reading: the README above, with router-utils/tests/helpers.ts open (toy planners and an in-memory host that use every interface). The full reading order is under How to review.

Placement rules: what goes into which output
  • Route files are placed as main splits them: main's shared names go into one shared module; chunks import Route, what export const|let|var declares and the shared names, and copy the rest.
  • The module itself loses only what the compiler's own changes made unused: a declaration or import goes when removed code used it (a use in a type counts) and nothing left uses it as a value. Top-level statements are never deleted.
  • A derived output that would assign a binding it imports, or a copy another output also holds, leaves that code in place, and the planners run again.
Server functions (lazy handlers, builder escapes), the verifier, caching and hosts
  • Lazy server-fn handlers (when SSR is the provider). Each server fn has one instance, and so does whatever its handler shares with its module. The defining file holds a server fn only when the file's own remaining code uses it; otherwise the file's lazy server module (?tss-serverfn-handler) holds it, with its validator and middleware, and imports what the file keeps. A split chunk that calls it holds a caller copy, as on main: the user's own chain with the validator dropped and the handler replaced by createSsrRpc(id). Calls go through the registry to the one executing instance.
  • Builder escapes. start-env tracks each Start builder or factory through bindings, re-exports, namespaces and factories. A use it can't follow is a compile error at that use: a client build fails before it emits, and in dev the module fails (overlay).
  • Verifier (TSR_COMPILER_VERIFY=1, on in the oracle). Every output is re-parsed and checked: no assignment to an import, glue imports resolve, each kept top-level statement is emitted once in its home and once per chunk that copies it, and no output reads a module binding it neither declares nor imports. A separate server-code check fails a client build that would hold recognised server code (a temporary safety net, see Losses).
  • Caching and hosts. Caching is a plan cache, a dependency ledger and one invalidate(); no Yuku objects are retained. We own the hosts: a native Vite plugin, a Rspack/webpack loader, and Start Rsbuild loaders (with buildInfo replay for the persistent cache). Start's Vite and Rsbuild hosts share one bundler-free Start session. unplugin remains only for the generator and esbuild.

Performance

Measured with benchmarks/compiler-perf at 0c3f86ecb9 against main 0b6d4f3f6b: medians over 4 paired rounds, times in ms, memory in MB. Large = 1,485 route files, medium = 333 (338 on Start). n.s. = the 95% CI includes 0; every other Δ in these tables excludes it. Method, CIs and footnotes are in the details below. Every other measurement names its own commit.

Large apps

large app measure main, ms this PR, ms Δ faster
react-start Vite build 30,905 8,079 −74% 3.8×
dev cold → hydrated 24,684 7,483 −70% 3.3×
compile-all 32,117 7,102 −78% 4.5×
HMR route edit 64.3 36.5 −43% 1.8×
react-start Rsbuild ¹ build 27,267 6,053 −78% 4.5×
dev cold → hydrated 31,915 6,457 −80% 4.9×
HMR route edit 970 588 −39% 1.6×
react-router Vite build 11,383 3,073 −73% 3.7×
dev cold → hydrated 11,763 3,080 −74% 3.8×
compile-all 27,488 5,088 −81% 5.4×
HMR route edit 54.2 27.3 −50% 2.0×
solid-start Vite build 42,815 18,760 −56% 2.3×
dev cold → hydrated 30,775 10,248 −67% 3.0×
compile-all 43,970 18,220 −59% 2.4×
HMR route edit 59.1 30.7 −48% 1.9×
solid-router Vite build 17,242 7,918 −54% 2.2×
dev cold → hydrated 14,414 4,509 −69% 3.2×
compile-all 40,944 15,859 −61% 2.6×
HMR route edit 41.3 19.4 −53% 2.1×

Across all 11 cells (medium and large), every cell builds, cold-starts and compiles significantly faster. Build −54…−79%, cold start −54…−80%, compile-all −56…−82%, listen −25…−80%.

HMR by edit kind

Δ of the HMR p50 per edit kind. Slower cells are in bold and listed under Losses. – = not measured in that cell. Neither side full-reloads on any edit.

cell route component route loader server fn shared module <Hydrate>
react-start Vite medium −21.2% +17.1% −72.2% n.s. −9.8%
react-start Vite large −43.4% n.s. −78.3% n.s. −18.6%
react-start Rsbuild medium −28.7% −34.0% −39.0% −19.7% −68.0%
react-start Rsbuild large ¹ −39.4% −41.7% −44.0% −25.8% −51.6%
react-start-deps Vite medium ³ −19.0% +13.8% −51.8% n.s. –
react-router Vite medium −29.1% +35.2% – n.s. –
react-router Vite large −49.7% n.s. – n.s. –
solid-start Vite medium −15.9% −17.2% −73.0% n.s. −43.8%
solid-start Vite large −48.1% −13.9% −78.8% −13.4% −64.8%
solid-router Vite medium −38.1% −35.7% – +8.2% –
solid-router Vite large −53.0% −47.5% – +8.7% –

Memory

large app dev heap after GC Δ build peak RSS Δ
react-start Vite 702 → 202 −71.3% 2,514 → 1,426 −43.3%
react-start Rsbuild ¹ 640 → 202 −68.5% 2,451 → 1,711 −30.2%
react-router Vite 130 → 87.5 ² −32.7% 1,290 → 1,023 −20.7%
solid-start Vite 617 → 202 −67.2% 2,939 → 2,067 −29.7%
solid-router Vite 92.5 → 91.3 ² n.s. 1,202 → 1,231 n.s.
  • Dev heap after GC is lower on every cell except solid-router large (n.s.). Build peak RSS is lower on every cell except solid-router large (+2.4%, n.s.).
  • Build heap after GC is 3.1–11× lower on Start and 1.2–1.7× lower on Router.
  • Dev peak RSS is 20–58% lower on nine cells; react-start Rsbuild medium (−10%) and solid-router large (−14%) have CIs that include 0.
  • 100 edit + revert cycles show no growth (eedc638e42).

Losses against main

One line each; the first three are detailed below.

  • React loader and options edits on Vite, on a route that keeps a component in its module: +17.1%, +13.8% and +35.2% on the three medium React cells at 0c3f86ecb9 (n.s. on the large ones). The cause is a wait, not compile work: a route update is held until React Refresh's next pass, which @vitejs/plugin-react debounces by 16 ms. Since then a route module that holds no component refreshes at once (loader edits −28.6% on react-start Vite medium); the loss stands for an unsplit route and for a route with an unsplit pendingComponent.
  • Shared-module edits on Solid Router: +0.5 ms on medium (+8.2%) and +0.6 ms on large (+8.7%). Our hotUpdate re-checks the plans of the edited file's importers; main doesn't track that dependency. Not worth changing.
  • Rsbuild dev source-map text: 14–17 ms of CPU per hot update on a medium app and 37–50 ms on a large one, to fill the original file text into emitted .map files after hashing. Save → DOM is within noise.
  • The server-code check: 1.3–1.5% of a client route compile, and 0.2–0.7% of compiler time in a whole run (0c3f86ecb9). It is a self-contained safety net, to be removed a couple of months after the release.
  • Import protection on Rsbuild: 7.5 ms per hot update on the 1,485-route app (1.3% of that update's compiler CPU, 0c3f86ecb9), to tell which importers still exist.
  • Server bytes: react-start.rsbuild.full is +605 B raw / +79 B gzip against main ("Server bytes" under Other measurements).
  • Client bytes of the server-fn stub: +5…+19 B gzip, once, on a Start client whose server fns are all used; 0 on a client without server fns, and about −50 B gzip for each exported server fn the client never uses ("Client bytes" under Other measurements). Each stub is one pure-annotated call of a helper of ours, createClientServerFn(id, chain), which ships once: an annotation on the user's own chain would let bundlers drop the user's calls in it.
  • Vite cold start with many plain modules (synthetic): compiling 3,000 one-line modules that hold nothing for Start, in both environments, is +5.4% [1.9, 8.9] with import protection on (the default) and +42.8% [35.9, 49.9] with it off (d5f1352c43, 8 paired rounds). main's text filter skips a module that names no Start API; we parse every app module and resolve its imports to know whether they are Start values, about 0.14 ms per module and environment. The generated and real apps above hold such modules too and are faster overall.
  • First SSR response on the large React Start app (Vite build): +1.6…+3.0% (about 2 ms of 133 ms; three runs of 48 pairs, d5f1352c43), once per server process; later requests are equal or faster. The server-fn modules that request loads are larger (they hold the server wrappers and load handlers lazily); the rest isn't attributed.
  • Build peak RSS on two large apps (0331deb61c, paired): kroma +5.4% [1.3, 8.3] (+93 MB, 5 rounds; one main outlier at 2,904 MB left out, with it n.s.) and bm.md +5.8% [2.2, 9.5] (+110 MB, 12 quiet rounds). Their builds are 4.1% and 1.8% faster. bm.md (Start) has less live heap than main: its peak depends on when the last mark-compact runs, and nothing was found to change. kroma wasn't re-measured after the Vite node_modules filter below, which may cover it: it wraps its plugins in its own bundler package, so whether it uses the router's Vite plugin wasn't checked.
    • LibrePhotos and Observal were +8.8% and +10.7% at 0331deb61c. The router plugin's Vite transform handed every dependency module's text to the plugin (LibrePhotos: 9,763 of 10,950 calls), and the garbage that left raised the peak. With dependencies filtered out natively (2501c14687, 12 paired rounds), both are below main: LibrePhotos 1,252.5 → 1,146.5 MB (−8.4% [−8.9, −8.0]), Observal 880.5 → 852 MB (−3.3% [−3.9, −2.7]), with byte-identical output and builds 31% and 11% faster than main. That run was on a machine with no free huge pages, where the head without the filter read −0.8% [−1.6, 0.1] and +3.3% [2.4, 4.2].
Losses in detail: the React Refresh wait, Solid shared-module edits, Rsbuild map text
  • React loader and options edits on Vite, on a route that keeps a component in its module. At 0c3f86ecb9 loader edits were slower than main on the three medium React cells: react-start +17.1% [13.5, 21.2] (57.8 → 67.7 ms), react-start-deps +13.8% [9.5, 19.7] (60.8 → 69.2 ms) and react-router +35.2% [4.8, 57.4] (25.4 → 34.4 ms). On the large React cells the CIs include 0. The loss was a wait, not compile work: a route update is held until React Refresh's next pass, which @vitejs/plugin-react debounces by 16 ms (Run React Refresh at vite:afterUpdate instead of after a fixed 16 ms vitejs/vite-plugin-react#1565), so that a route's components and options land together.
    • Now a route module that holds no component refreshes at once: every component option is split, deleted or a literal such as undefined. Loader edits are −28.6% [−32.8, −26.9] on react-start Vite medium (64.7 → 46.1 ms; main read 57.8 ms in the matrix run above). On react-router Vite medium they are −57.5% [−58.7, −57.0] (33.9 → 14.4 ms; main 25.9–33.4 ms), measured with the probe route's pendingComponent removed. These are A/B runs against the head before the change, 4 paired rounds, 20 edits per kind.
    • The wait stays, so the loss stands, for an unsplit route and for a route with an unsplit pendingComponent. The default groupings don't split pendingComponent, and the generated apps give one to about 30% of their routes. With its pendingComponent, the react-router probe route reads 34.8 → 34.7 ms (unchanged). Rsbuild loader edits are unchanged (202 ms either way; −34% against main at 0c3f86ecb9).
    • The cost, kept on purpose: component edits of a route whose only component is split are +1.9 ms (+6.8% [6.1, 8.3], react-router Vite medium, 26.5 → 28.4 ms), still faster than main (37.8 ms in the matrix run). On Vite the route refresh now runs at once and the component swap after React Refresh's pass, likely two renders instead of one (not verified). Avoiding it needs new ordering state for route refreshes.
  • Shared-module edits on Solid Router: +0.5 ms on medium (6.1 → 6.6 ms, +8.2% [6.1, 10.8]) and +0.6 ms on large (6.3 → 6.9 ms, +8.7% [5.1, 11.5]), at 0c3f86ecb9. Before Vite sends the update, our hotUpdate reads the edited file again and re-checks the plans of its importers (0.43 ms per edit), so an edit that changes an importer's output reaches the page. main doesn't track that dependency. Not worth changing.
  • Rsbuild dev source-map text. Filling the original file text into emitted .map files after hashing costs 14–17 ms of CPU per hot update on a medium app and 37–50 ms on a large one. Save → DOM is within noise: −1.1% [−6.5, 1.2] without the fill (react-start Rsbuild medium, 4 paired rounds, 0c3f86ecb9). Rspack won't fill it natively ([Feature]: fill missing sourcesContent from the module resource when emitting source maps web-infra-dev/rspack#16348, closed: a map's text must take part in HMR invalidation).
    • At 0c3f86ecb9 a reload or a new tab could show a split chunk's previous text after an edit that left that chunk's code unchanged: Rspack writes an asset again only when its version changes. Now a new fill of an unchanged chunk's map gets its own version. The server environment's maps are filled only when Rsbuild writes them to disk (dev.writeToDisk), because nothing reads them in memory. Against the head before the fix (react-start Rsbuild medium, 4 paired rounds, 20 edits per kind), route component edits are +3.7% [−0.6, 6.8] (n.s.) and loader edits −5.8% [−6.9, −4.3].
Method and footnotes ¹ ² ³

Measured with benchmarks/compiler-perf at 0c3f86ecb9 against main 0b6d4f3f6b. Both checkouts run at once on mirrored core sets, swapped per round and per cell, over 4 paired rounds. Each round is 1 warmup + 1 run, 10 edits per HMR kind and 1 memory run. Each cell starts only once the 1-minute load average is below 8. 16 of the 44 cell-rounds saw a load reading of 12 or more from other jobs and were re-run at a load of 3.8 or less. Values are medians, times are in ms and heap in MB. In parentheses: Δ% and its 95% t interval over the paired log ratios. Large = 1,485 route files. Every other measurement below names its own commit.

n.s. = the 95% CI includes 0.

¹ Two of main's Rsbuild runs failed in the harness, and this PR's runs had no failures. In react-start Rsbuild large round 3, main's run aborted when it opened the <Hydrate> probe page (page.goto: net::ERR_ABORTED), so memory and <Hydrate> HMR have 3 rounds in that cell. In react-start Rsbuild medium round 1, main's dev memory run hit the harness's dev port race (ERR_CONNECTION_REFUSED). Rsbuild route-edit medians per round: this PR 578–629 ms, main 904–1,143.

² main's dev heap is bimodal across runs on these cells. On react-router large, all four rounds read 130 MB (on 11-16 all four read 103). This PR reads 87.5 MB in all four rounds, which is −15% against main's lower mode. On solid-router large, main reads 92.4 MB in three rounds and 120.4 in one, and this PR reads 91.3–93.3.

³ react-start plus a generated dependency graph and tanstack.com's manualChunks. Dev SSR fails on both sides here because of a ?url wasm asset in the harness, so <Hydrate> HMR is not measured.

All 11 cells: values, Δ with 95% CIs, HMR p50 in ms

0c3f86ecb9 vs main 0b6d4f3f6b, the same run as the table above. Medium = 333 route files (338 on Start). Δ CIs are 95% t intervals of the paired log ratios.

cell build dev listen cold → hydrated compile-all dev heap after GC build peak RSS
react-start Vite medium 6,460 → 1,545 623 → 211 6,161 → 2,574 7,333 → 2,070 212 → 87.5 1,146 → 828
react-start Vite large 30,905 → 8,079 1,482 → 325 24,684 → 7,483 32,117 → 7,102 702 → 202 2,514 → 1,426
react-start Rsbuild medium 6,730 → 1,903 215 → 158 7,877 → 2,088 – 193 → 85.2 946 → 763
react-start Rsbuild large ¹ 27,267 → 6,053 211 → 159 31,915 → 6,457 – 640 → 202 2,451 → 1,711
react-start-deps Vite medium ³ 6,887 → 1,717 631 → 214 6,766 → 3,122 8,016 → 2,379 234 → 106 1,180 → 1,034
react-router Vite medium 2,869 → 596 573 → 183 3,380 → 1,108 6,738 → 1,404 63.8 → 46.2 743 → 565
react-router Vite large 11,383 → 3,073 1,355 → 277 11,763 → 3,080 27,488 → 5,088 130 → 87.5 ² 1,290 → 1,023
solid-start Vite medium 9,563 → 4,336 639 → 275 7,382 → 3,225 10,815 → 4,721 190 → 92.3 1,330 → 1,081
solid-start Vite large 42,815 → 18,760 1,502 → 358 30,775 → 10,248 43,970 → 18,220 617 → 202 2,939 → 2,067
solid-router Vite medium 4,541 → 2,030 621 → 249 3,876 → 1,628 10,320 → 4,436 63.0 → 53.8 800 → 713
solid-router Vite large 17,242 → 7,918 1,465 → 332 14,414 → 4,509 40,944 → 15,859 92.5 → 91.3 ² 1,202 → 1,231

Δ% [95% CI] of the same cells:

cell build dev listen cold → hydrated compile-all dev heap after GC build peak RSS
react-start Vite medium −76.1 [−76.8, −75.3] −66.2 [−66.7, −65.9] −58.2 [−59.7, −56.8] −71.8 [−72.9, −70.6] −58.6 [−58.7, −58.6] −27.7 [−30.1, −23.6]
react-start Vite large −73.9 [−74.4, −73.1] −78.1 [−80.0, −76.2] −69.7 [−71.2, −68.4] −77.9 [−78.1, −77.6] −71.3 [−71.3, −71.3] −43.3 [−47.1, −38.3]
react-start Rsbuild medium −71.7 [−72.4, −70.5] −26.3 [−32.0, −17.7] −73.5 [−74.2, −72.7] – −55.9 [−56.0, −55.9] −19.4 [−24.4, −13.2]
react-start Rsbuild large ¹ −77.8 [−78.9, −76.3] −24.6 [−26.2, −20.5] −79.8 [−81.5, −76.1] – −68.5 [−68.6, −68.3] −30.2 [−42.1, −23.8]
react-start-deps Vite medium ³ −75.1 [−76.1, −74.2] −66.1 [−69.1, −63.0] −53.9 [−57.3, −49.4] −70.3 [−71.8, −69.2] −54.7 [−54.8, −54.7] −12.4 [−14.6, −10.3]
react-router Vite medium −79.2 [−79.6, −78.4] −68.1 [−71.1, −63.9] −67.2 [−70.2, −64.3] −79.2 [−80.6, −78.3] −27.7 [−27.8, −27.5] −23.9 [−27.9, −16.4]
react-router Vite large −73.0 [−73.7, −72.1] −79.5 [−81.1, −78.5] −73.8 [−75.7, −71.9] −81.5 [−81.8, −80.7] −32.7 [−33.2, −32.2] ² −20.7 [−21.4, −19.4]
solid-start Vite medium −54.7 [−55.2, −54.4] −56.9 [−60.8, −52.1] −56.3 [−57.9, −55.2] −56.3 [−57.7, −54.8] −51.5 [−51.6, −51.5] −18.8 [−34.2, −8.3]
solid-start Vite large −56.2 [−56.9, −55.7] −76.2 [−77.3, −75.1] −66.7 [−67.1, −66.2] −58.6 [−59.1, −58.0] −67.2 [−67.6, −66.9] −29.7 [−38.1, −19.0]
solid-router Vite medium −55.3 [−58.2, −52.1] −59.9 [−62.7, −54.5] −58.0 [−60.0, −54.0] −57.0 [−68.7, −49.4] −14.6 [−14.6, −14.6] −10.9 [−13.0, −8.2]
solid-router Vite large −54.1 [−54.1, −54.0] −77.4 [−79.1, −75.4] −68.7 [−72.3, −65.0] −61.3 [−62.3, −59.8] −1.2 [−25.1, 15.4] n.s. ² +2.4 [−6.2, 8.4] n.s.

HMR p50, ms, main → this PR, Δ% [95% CI]:

cell route component route loader server fn shared module <Hydrate>
react-start Vite medium 45.5 → 35.9, −21.2 [−23.9, −18.7] 57.8 → 67.7, +17.1 [13.5, 21.2] 47.4 → 13.2, −72.2 [−73.2, −70.6] 22.4 → 22.9, +2.2 [−1.6, 4.4] n.s. 378 → 341, −9.8 [−12.8, −7.5]
react-start Vite large 64.3 → 36.5, −43.4 [−44.8, −42.4] 138 → 139, +0.5 [−0.7, 1.5] n.s. 146 → 31.6, −78.3 [−79.4, −76.8] 23.5 → 23.1, −1.5 [−5.4, 1.9] n.s. 417 → 339, −18.6 [−19.8, −17.2]
react-start Rsbuild medium 229 → 163, −28.7 [−30.6, −25.7] 308 → 203, −34.0 [−35.8, −31.2] 286 → 174, −39.0 [−46.2, −32.1] 202 → 162, −19.7 [−23.4, −14.0] 534 → 171, −68.0 [−69.3, −67.4]
react-start Rsbuild large ¹ 970 → 588, −39.4 [−51.0, −26.7] 1,465 → 854, −41.7 [−51.3, −31.3] 1,404 → 786, −44.0 [−46.1, −40.7] 764 → 567, −25.8 [−34.1, −17.6] 1,181 → 572, −51.6 [−67.2, −31.3]
react-start-deps Vite medium ³ 44.5 → 36.1, −19.0 [−20.7, −18.1] 60.8 → 69.2, +13.8 [9.5, 19.7] 27.6 → 13.3, −51.8 [−55.4, −48.3] 22.8 → 22.9, +0.7 [−2.8, 4.3] n.s. –
react-router Vite medium 37.8 → 26.8, −29.1 [−43.1, −19.5] 25.4 → 34.4, +35.2 [4.8, 57.4] – 21.9 → 21.9, +0.0 [−1.4, 3.1] n.s. –
react-router Vite large 54.2 → 27.3, −49.7 [−50.7, −49.1] 38.6 → 37.9, −1.8 [−4.9, 1.6] n.s. – 22.0 → 22.1, +0.2 [−2.8, 3.1] n.s. –
solid-start Vite medium 35.8 → 30.1, −15.9 [−20.5, −11.1] 61.6 → 51.0, −17.2 [−21.6, −13.8] 50.7 → 13.7, −73.0 [−73.5, −72.6] 7.8 → 7.3, −7.1 [−16.0, 5.7] n.s. 65.6 → 36.9, −43.8 [−46.4, −41.2]
solid-start Vite large 59.1 → 30.7, −48.1 [−48.6, −47.2] 145 → 125, −13.9 [−18.8, −5.1] 153 → 32.5, −78.8 [−80.6, −77.3] 9.7 → 8.4, −13.4 [−26.1, −3.4] 105 → 37.0, −64.8 [−67.4, −62.4]
solid-router Vite medium 26.8 → 16.6, −38.1 [−47.0, −16.2] 31.6 → 20.3, −35.7 [−49.5, −24.4] – 6.1 → 6.6, +8.2 [6.1, 10.8] –
solid-router Vite large 41.3 → 19.4, −53.0 [−55.9, −50.6] 44.3 → 23.3, −47.5 [−51.3, −42.1] – 6.3 → 6.9, +8.7 [5.1, 11.5] –

HMR p50 by kind, cells whose CI excludes 0:

  • Route component: −16…−53% on Vite, and −29% / −39% on Rsbuild.
  • Server fn: −39…−79%.
  • <Hydrate>: −10…−65% on Vite, and −68% / −52% on Rsbuild.
  • Shared-module edits: −20% / −26% on Rsbuild, −13% on solid-start large.
  • Loader edits: −14…−48% on Solid and −34% / −42% on Rsbuild. On the large React cells the CIs include 0.
  • Slower: the React loader edits (at 0c3f86ecb9; faster now on routes whose module holds no component) and the Solid Router shared-module edits listed under Losses.
tanstack.com: build 15.3 → 9.4 s (−39%), first hydration −14%, edits at parity

598befed, offline, fresh caches, 0c3f86ecb9 vs main 0b6d4f3f6b, one side at a time, 5 clean pairs.

  • Build: 15.3 → 9.4 s (−39%). Build peak RSS: 4.46 → 3.94 GB (−12%).
  • Dev: first hydration 25.7 → 22.1 s (−14% [−23, −2]). Over a first visit of 15 routes the dev server uses 23% less CPU [−26, −3], and what those visits add over a visit with nothing to compile is 19% lower [−30, −7]. The visits' total (11.8 s both), route edits (199 → 169 ms), shared-component edits (135 → 122 ms) and server-fn edits (507 → 539 ms) are at parity: each CI includes 0.
  • Why the totals don't follow the compiler: in dev each tanstack.com page loads about 2,150 modules, and the same crawl with nothing left to compile takes 75–83% of the cold one. The compiler is 0.51 s of it (main: 0.80 s). An edit waits on Tailwind rebuilding the stylesheet (~100 ms) and the browser applying the update (40–60 ms); the compiler is 7 ms of a route edit (main: 32 ms) and 2 ms of a shared-component edit.
  • Ours on the edit path: at 0c3f86ecb9 our hotUpdate held a route edit's update 6 ms longer than main and a shared edit's 5 ms. For the route edit it transformed the route module in each environment to learn which split chunks still exist, the SSR environment included (6–9 ms of it on tanstack.com); for the shared edit it re-checks the importers' plans. Now the SSR environment compiles the route module in hotUpdate only when a derived module of the update needs it. On react-start Vite medium that hook takes 0.18 ms per call instead of 1.80 (2 rounds per side, 48 calls each), and route component edits are 3.3% faster [−9.1, −0.3] (4 paired rounds). tanstack.com wasn't re-measured.
e18e framework tracker: dev startup −9.9%, cold build −13.9%, warm build −14.3%

e18e framework tracker (their harness and starter on 2 CPUs, 12 paired rounds, 0c3f86ecb9 vs main 0b6d4f3f6b, 0 errors): dev server startup 1,452 → 1,308 ms (−9.9%, 95% CI [−11.1, −8.1]), cold build 1,547 → 1,332 ms (−13.9%, [−14.4, −12.7]), warm build 1,394 → 1,194 ms (−14.3%, [−15.3, −12.9]). Scaled onto the tracker's published values of 10-29, that would move TanStack Start from 5th to 4th place in cold builds (1,748 vs SvelteKit's 1,821 ms) and from 5th to 3rd in warm builds (1,560 vs React Router's 1,617 ms), and leave it 5th in dev startup. The places weren't checked against the tracker's current results. The build margins (3.5–4%) are smaller than the tracker's run-to-run spread.

Other measurements against main: issue repros, soak, real apps, Vue, webpack, RSC, bytes
  • Start: import protection keeps a parsed AST per module in dev (hundreds of MB in large apps) #8614 (0c3f86ecb9, the reporter's 1,500-module workload): import protection in dev adds +3 MB of live heap, where main adds +322 MB.
  • [Start] vite build keeps every environment's server-fn compiler alive until the build ends (memory stacks across client → ssr → server) #8794 (0c3f86ecb9, 3,000 modules, 600 routes, Nitro): heap when the last environment starts is 65.6 MB, vs 500.0 MB on main.
  • 500-cycle soak (18ef570edc, KB per cycle, PR vs main): react-start Vite −0.7 vs 11.2, react-router Vite 2.3 vs 6.3; react-start Rsbuild 20.9. The remaining growth is upstream: Dev server module graph keeps nodes of deleted files for the life of the server vitejs/vite#23907, and [Bug]: Dev server's in-memory output file system keeps every hot-update file web-infra-dev/rsbuild#8736 (fixed in Rsbuild 2.3.0).
  • Real-app corpus (0331deb61c vs main 0b6d4f3f6b, 126 apps, each with its own toolchain, 3 paired rounds, medians of per-app Δ): build −14.6%, dev ready −20.0%, first render −12.9%, peak RSS −4.8%. No app builds slower (111 faster with a CI below 0). Peak RSS is higher in 18 (at most +140 MB).
  • 14 large apps (0331deb61c vs main 0b6d4f3f6b, each with its own toolchain): all 14 build on both sides with the same warnings (one reworded generator message). Builds are 4–31% faster in 11 (redpanda, Rsbuild + Module Federation, −6.7%), at parity in 3 (bm.md −1.0%, CADAM −3.7%, Bombom). kroma (barrel-heavy) builds 4.1% faster. tamery, which failed on the PR side before, builds too. Peak RSS is higher on three of them, re-measured on a quiet machine (12 paired builds each): bm.md +5.8% (+110 MB, 95% CI [2.2, 9.5]), LibrePhotos +8.8% (+121 MB, [7.0, 10.6]) and Observal +10.7% (+114 MB, [6.2, 15.4]). LibrePhotos and Observal are below main since the Vite node_modules filter (2501c14687, under Losses).
  • Vue on Rsbuild (0331deb61c vs main, 200 generated SFCs): an SFC without Start costs the same on both sides (<script setup> +0.10 ms [0.00, 0.19], <script> −0.11 ms [−0.32, 0.10] per SFC). A top-level server fn in a plain <script lang="ts"> block adds 1.83 ms [1.66, 2.00] per SFC; main fails that build.
  • Other builds (0331deb61c vs main): webpack build (React Router medium) 6,455 → 4,214 ms, −34.7% [−36.0, −33.0]; RSC build (React Start RSC medium) 8,846 → 2,478 ms, −72.0% [−72.6, −71.2].
  • Vue (October, 1 paired round on medium apps against main da2adec76d; the PR-side commit isn't recorded, and it wasn't re-measured): Vue Start / Vue Router build 8,665 → 3,917 / 4,162 → 1,588 ms, cold start 10,692 → 3,073 / 5,017 → 1,349 ms.
  • Client bytes (18 scenarios, 0331deb61c vs main 0b6d4f3f6b, both measured on 2026-11-17 on one machine): none grows in gzip or raw. 12 are byte-identical. Six are 1–10 B gzip smaller (6–20 B raw): react-start.full −8, react-start.rsbuild.full −1, react-start.rsbuild.minimal −10, react-start.rsbuild.minimal-iife −3, solid-start.full −4 and vue-start.full −6. In brotli, two of those six are larger: react-start.full +9 B and solid-start.full +4 B.
    • Since then the server-fn client stub (5dd914a2f9) ships its helper once in a Start client with server fns. Against c99ee06725 (bytes identical to 0331deb61c): react-start.full +19 B gzip, vue-start.full +9, solid-start.full +6; the other 15 scenarios are unchanged. Summed with the run above, that puts react-start.full at +11 B gzip against main, vue-start.full at +3 and solid-start.full at +2 (not re-measured at the head). The full fixtures have no unused server fn; in a scratch app with 4 used and 4 unused exported server fns, the client is 213 B (Vite) and 205 B (Rsbuild) gzip smaller than before the change.
  • Server bytes (ad2b1855cc vs main e7358c36d8, .js/.mjs summed per server directory): Vite scenarios are −450…+4 B raw. react-start.rsbuild.minimal is +23 raw / −10 gzip. react-start.rsbuild.full is +605 raw / +79 gzip: the resolver imports the defining module, which makes __root a second concatenation root, and lazy handlers add their per-file glue; one named cache group that merges the server-fn provider chunks into the router chunk recovers −94 raw / −248 gzip of it.

Testing

The oracle (packages/compiler-test-utils/oracle) drives real bundlers, dev servers and browsers through public APIs only. main's bugs are pinned as .fails.

baseline (main's compilers, 80d1890bed) this branch
tests 3,594 about 6,290
known-bug pins (.fails) 874 55
non-pin failures 0 0 (one known flake, below)

The suites were pruned at the end to one standard: passing them must guarantee a working compiler even if every internal were rewritten. Internal tests were deleted behind a coverage gate and a mutation gate, and replaced by behaviour tests where they were the only cover of a reachable path. Start's src coverage is 95.1% of lines and 84.1% of branch arms.

Final local gates. The full set ran at 8014d07f4e, after the first external review round: the Vite router transform's node_modules filter and the fixes from that review of the core, the router, the hosts and Start (each with its own tests). The previous runs were at 0331deb61c and 2322af5907. The full e2e suite and the platform jobs run in CI on the pushed head.

Since 8014d07f4e: the fixes from a second review round (each with a regression test) and the server-fn client stub. Each change ran unit, types and eslint of the packages it touched, and its own regression tests. The client-stub change also ran the corpus (server outputs unchanged; client outputs identical once the stub's new shape is normalised, except 2 that lose an eslint-disable comment written inside .handler(), the leak canary (identical sets), the bundle benchmark (above), and the server-function and RSC e2e suites on Vite and Rsbuild. The full gate set wasn't run again at the head.

Gate by gate: corpus, differential gates against main, leak canary, bundle bytes, integration, e2e
gate at result
unit, types and eslint of the 13 touched packages that have them, plus Start's non-compiler tiers (37 targets, uncached) 8014d07f4e all passed
Corpus (58,075 compiles, 120,300 outputs, verifier on) 8014d07f4e 0 throws, 0 unparseable; two runs identical, and every compile identical to 0331deb61c
Babel re-parse of every corpus output 8014d07f4e 0 rejected
Route splitting against main (12,337 corpus route files, 156 fixtures) 8014d07f4e every row identical to 0331deb61c on both sides. 12,113 corpus rows equal or better. 30 have more eager bytes than main: 13 are gate artefacts (inputs that are already compiler output, a Solid file compiled as React) and 17 are +1 to +23 B (a binding imported where main copies it, minifier naming, one string component now split). 45 split fewer options, the same recorded set as in earlier runs. 3 fail only on main, 146 on both
Erasure against main (161 probes, 8,359 corpus files; leaks, imports, kept statements, bytes, run trace) 8014d07f4e 0 leaks; every row's class and kinds as at 2322af5907
<Hydrate> against main (2,312 records) 8014d07f4e 0 leaks; every record identical to 2322af5907, failing kinds are the recorded limits
RSC-environment outputs (8,520 inputs, 37,235 modules) 8014d07f4e identical to 2322af5907 except one probe's split chunk, by the anonymous default class fix
Leak canary (139 builds of in-repo Start apps, 138 built; clerk-basic fails on main too) 8014d07f4e 0 of 1,328 server-only canaries in client JS, HTML or CSS, the same sets as at 0331deb61c. main: 2 (a marker leak, pinned)
Leak canary with vite build --sourcemap 2322af5907 Client maps hold the original text of client-imported modules on both sides (784 canaries only in maps here, 787 on main): no new exposure
Bundle benchmark (18 scenarios) 8014d07f4e identical to 0331deb61c; against main, 12 identical and 6 smaller in gzip (before the server-fn client stub: "Client bytes" under Performance)
Route shapes against main (52 fixtures × 3 groupings) 8014d07f4e the 5 recorded recognition rows; every output identical to 2322af5907
router-plugin integration (1,520 tests) 8014d07f4e 1,507 passed, 13 pins
start-plugin-core integration (3,108 tests) 8014d07f4e 3,056 passed, 40 pins, 12 skipped
react-start-rsc integration (201 tests) 8014d07f4e all passed
e2e subset: React Start HMR (Vite, Vite bundled dev, Rsbuild), server functions (Vite, Rsbuild, Rsbuild build cache), RSC (12 shards), deferred hydration (React and Solid, Vite and Rsbuild) 8014d07f4e all passed

Known flakes:

  • A split component reached through an object read as a JSX member tag (router-plugin, Vite): a transform request started while hotUpdate hooks run is cached with the old timestamp, so the module exists twice. It fails on main too when forced; an upstream draft isn't filed yet.
  • Watchpack double compile: a save that lands in the millisecond its compile starts compiles twice, about 1 save in 10 on a long-lived Rsbuild server ([Bug]: A save seen in the millisecond its watch compile starts compiles twice web-infra-dev/rspack#16511). Plain Rsbuild does it too, and the output is the same.
  • Solid serialization-adapters stream: the router's $_TSR.e() deletes $_TSR before Solid's last script reads it. It fails on main too (about 1 run in 4). It isn't a compiler bug and is out of scope here.

Beyond the oracle:

  • Differential gates against main (the table above): main's compiler and this PR's run on the same inputs and are compared for leaks first, then imports, bytes and runtime behaviour. All 14 planted compiler faults are caught by the erasure gate.
  • Real-app corpus: 190 public repos, each built and dev-tested with npm main and with this PR, in a network-restricted sandbox.
  • Start app corpus for the shape rules: 250 cloned app roots and 3,677 sampled roots, read for false refusals.
  • Differential fuzzers for compiler output (against the untransformed source), the route generator, and HMR edit sequences on 5 frameworks. The generators stay outside the repo; each case they found is a static test.
  • Reviews: external review rounds by agents with no project context, each finding fact-checked against the head and main. The last round had separate passes for architecture, performance (with measurements), maintainability, core placement, <Hydrate>, server-fn security and import protection. The security pass found no leak and nothing callable over HTTP that main refuses; main answers more (a private helper, on every host). Independent coherence, dead-code and coverage reviews too. Every PR bug they found is fixed with a regression test, except the open items under Follow-ups.
Corpus and fuzzer results (October)

Corpus (b25984c166 vs npm main):

  • Builds: 189/190 build on both. The 1 PR-only failure was a type-only import re-emitted as a value import, fixed in 390ca815c3.
  • Bytes: client JS 405.01 → 404.72 MB, initial JS 101.42 → 96.92 MB.
  • Leaks: 0 server-only canaries in client JS on either side.
  • Dev: 158 equal, 18 PR better, 4 PR worse, 6 mixed, 4 both fail. The 4 worse: the type import (fixed), a global-boundary reload (main's behaviour), a Vite optimizer race that exists without the PR, and noise.

Fuzzers:

Vite 6 and 7: the router-plugin e2e projects pass

Vite 6 / 7 (0331deb61c): the 13 router-plugin e2e projects pass on Vite 6.0.15, 6.4.5 and 7.3.7 (398 tests each, 0 failed or flaky). Split Solid and Vue routes update in place, as on main since #8870.

Remaining fail pins (55)

Each pin asserts the correct outcome and fails today. oracle/KNOWN-BUGS.md has the details and the accepted limits that aren't pins.

  • 20 of the 55 are one behaviour kept from main: route CSS is eager (applying it only once the route matches needs a per-route asset loader, a follow-up).
  • 5 are import forms that reach the client unreported, as on main (the "Not covered" row).
All 55 pins by reason
reason # expected behaviour still missing
Kept main's behaviour on purpose 20 Route CSS applies only once the route matches. This needs a per-route asset loader (follow-up).
1 A route edit after a render error the page already recovered from (by navigating away) updates in place. It reloads the page, as on main.
Accepted (safe direction) 5 An importer outside srcDirectory/include gets the real module of an in-scope denied file it imports. It gets the mock: the denied file is judged at its own compile, which doesn't know who imports it.
Known limitation 4 A Vue <script setup> block that hands a Start builder or factory to its template compiles. It is a compile error on the dev servers (Vite and Rsbuild) and in builds with Vue's devtools: there compiler-sfc hands the block's bindings to the template, in JavaScript every import too. No server code ships. Hit by a JavaScript block importing a builder or factory, and by any block whose local holds an open builder. Two of the four shapes (an imported builder the block never uses, a namespace of a module exporting one) built on main on Vite. A default production build inlines the template and builds, except on Vite with <template src>.
4 On Rsbuild and webpack dev, an ordinary module importing a binding from a route file sees an edit of that binding. It keeps the first value until a reload: the route module self-accepts and the importer's text doesn't change. The route file's own split chunks get the edit.
1 On Rsbuild, an edit that switches a route file's Route from createFileRoute to an app's own helper shows in place. It needs a reload, as on main.
Not covered, as on main 5 These forms on a client build are mocked and reported: a clean ?worker importing a denied file; new URL('./x.server.ts', import.meta.url); a marked .mdx/.vue with an asset query; a marked file that doesn't parse with an asset query; on Rsbuild, a plain webpackContext of a denied .json. They reach the client unreported.
Bundler limitation 1 On Rsbuild dev, a custom module type (.page as javascript/auto) importing a denied specifier is reported. Rspack rules select by resource.
1 On Rsbuild build, an unused exported component with a boundary emits no async chunk.
Upstream 1 On Rsbuild dev, adding a route's first server fn shows on the open page (web-infra-dev/rspack#16288).
1 On the Vite dev server, a request in flight when an edit reloads the SSR environment renders the page. It can render a broken route tree (404, or Duplicate routes found) (vitejs/vite#24046).
2 On Vite, a memo(Page as any) route component keeps its state on edit, with and without splitting. It remounts: oxc's React Refresh doesn't register through a TS cast (oxc-project/oxc#29281, fixed in oxc 0.159.0; no Rolldown release ships it yet).
5 After a rename or a removed component in a split Solid route file, later edits reach the page, on Vite and Rsbuild. They don't until a reload: solid-refresh keeps the removed name and stops patching the module (solidjs/solid-refresh#88). On Vite the rename itself shows here, where main shows neither.
Not supported yet 1 In Vite bundledDev, a factory that becomes a server-fn builder drops its handler from the client bundle. This needs the full-bundle API.
Accepted shape outcome 1 withBuilder(createIsomorphicFn().server(f)).client(g) keeps each implementation. .server() finished the value, so nothing refuses it and the module throws at load, as on main. No server code ships.
Not fixed, as on main 1 In Solid <Hydrate> children, ref={field} naming a module-level let binds the let the module reads. It binds the chunk's copy, so the module's own code reads undefined: a JSX ref isn't an assignment before Solid lowers it, so the module-write refusal misses it. Workaround: a let in the component, or split={false}.
Not fixed (worse than main) 1 <Hydrate> children passing the component's arguments as a shorthand property ({ arguments }) render its props. The chunk's rewrite of arguments is a text edit that doesn't see the shorthand: React gets the key tsrArguments (a hydration error) and Solid's chunk doesn't parse. The fix needs the capture scan to mark a shorthand property. Workaround: { arguments: arguments }.

Behaviour changes

Every item is a difference from main 0b6d4f3f6b, run on both sides unless it says otherwise.

group what it means
Different from main, accepted an app that works on main may need a change, or an accepted limit
Better than main main failed, shipped server code or showed stale code
Not guaranteed limits main has too

The 18 changesets this PR adds carry the same text for release notes (minor: start-plugin-core, react-start, solid-start, vue-start, react-start-rsc, router-plugin, router-generator, router-utils, router-core; patch: router-cli and react-router, solid-router and vue-router, start-client-core). It also edits start-server-fn-custom-id-check.md, which is already on main.

Different from main, accepted

Start: server functions and builders

  • .inputValidator() fails the client build at the call. main still compiles it, though the method left Start's runtime in refactor(start)!: remove the deprecated inputValidator #8694. If a dependency calls it, update the dependency.

    createServerFn().inputValidator(schema).handler(fn) // build error
    createServerFn().validator(schema).handler(fn) // fix
  • A client-only createIsomorphicFn().client(fn) or createMiddleware().client(fn) passed to other code fails the client build, as a precaution; main builds it.

    new QueryCache({ onError: createIsomorphicFn().client(report) }) // build error
    const mws = { log: createMiddleware().client(log) } // build error
    
    // fix: finish the chain where it is defined
    createIsomorphicFn().client(report).server(() => undefined)
    createMiddleware().client(log).server(({ next }) => next())

    Or pass the middleware to .middleware([…]) or createStart's lists directly.

  • A builder's options object passed on, written to, or read for its middleware list fails the client build; main builds these. .options is typed read-only.

    const base = createServerFn({ method: 'POST' })
    register(base.options) // build error: passed on
    const { middleware } = base.options // build error: its middleware list
    const method = base.options.method // fine: read the options you need by name
  • A server fn whose handler is itself createClientOnlyFn(…) throws when called (… can only be called on the client). main ran the client implementation on the server.

  • A Vite build whose ssr environment builds before the client fails, saying to build the client first. On main it builds a server that answers no server fn. Start's own buildApp is unaffected.

  • A virtual: module with a server-only marker (an id without \0) fails a Vite build, naming the module. main builds it. Fix: move the code into a file.

  • Kits that list Start under dependencies are excluded from Vite's dependency optimizer, like peer kits: a CommonJS kit, or a kit's CommonJS dependency, needs an optimizeDeps.include entry.

  • Some handlers load with their file instead of on the first call: a handler-only value that reads file state at load, a handler that assigns file state, and a module with top-level await (5 corpus files). main loads each handler, and its file a second time, on the first call.

  • A class, enum or namespace only a handler reads runs at the first call on the server. main runs it when the route loads and again at the first call, and ships it to the client. Fix: read it from code that runs at load.

  • A handler-only snapshot of an imported object that the file writes before and after it reads the later value. In import { cfg } from './state'; cfg.value = 'opening'; const onOpen = cfg.value; cfg.value = 'ready', a handler returning onOpen gets 'ready'; main runs the file again at the first call and gets 'opening'. Fix: read the snapshot from code that runs at load, or write through a local alias (const c = cfg).

  • The server namespace of a module with a lazy handler module has extra keys (Object.keys(ns) differs from the client's). Fix: enumerate an explicit list.

  • A server fn whose chain runs a function at load that reads a declaration of its own statement (an IIFE, a synchronous callback, a getter) builds, and the function reads the declaration before it is initialised (undefined in a Vite build). main fails these builds.

  • A server fn inside a statement is created before the statement's earlier operands run. In export const api = { first: update(), run: createServerFn({ method }).handler(fn) }, where update() sets method = 'POST', the chain reads method first and the server fn is GET. main fails the build (createServerFn must be assigned to a variable!). Fix: set what the chain reads before the statement, or declare the server fn at the top level.

  • .handler(selected), where the module assigns selected elsewhere, runs what selected holds at the first call; main takes the value when the chain is created. The build warns at the argument. Fix: pass a function written in place, or a const.

  • A server fn that reaches the browser only as data (a loader returning it) is no longer callable over HTTP in production builds; main answers it. Fix: reference it from client code.

  • Vite: a server fn of a node_modules library the app doesn't list in package.json, called during SSR, throws (500). main renders the page without the value. Fix: declare the library.

  • Ids that a custom generateFunctionId makes collide across files are numbered by file path (functions client code references first), on Vite and Rsbuild, not by compile order, so such ids can change once. Default ids, functionName, serverFnMeta and the manifest's quoting are unchanged. Dev-server ids have a new payload (dev only).

  • Two outcomes worse than main, kept on purpose: import('…/server-only') inside a function the client keeps no longer fails the build (a top-level one still does), and an isomorphic .client(() => ({ handler: (f) => f })) followed by iso().handler(h) ships h.

  • Vue <script setup>: the 4 pinned shapes above; two of them built on main on Vite.

  • Start on Rsbuild: an app's own binary file with a JavaScript extension, imported as an asset (src/media/clip.ts), fails the client build ("cannot parse"). main builds and emits a corrupted asset. The same file in a dependency is emitted unchanged here.

Route files and code splitting

  • React's classic JSX runtime isn't supported with automatic code splitting, nor in files Start compiles: a split chunk with JSX has no React in scope and throws React is not defined. main renders it. No known users; restoring it means copying never-used imports into chunks.

  • A second call of a route file's route constructor fails the build at that call, also through the router's namespace (Router.createFileRoute(…)), on every host, whatever its options hold. main builds it and serves the route (run on Vite, router-only and Start, with a second call holding only staticData). Fix: one call per file, bound to Route.

    export const Route = createFileRoute('/posts')({ component: Posts })
    const extra = createFileRoute('/posts')({ staticData: { title: 'Posts' } }) // build error
  • A re-exported createFileRoute (from an app module, another package, a package subpath or a # import) isn't recognised: the route is served as written and isn't split, and under Start its server, ssr and headers ship to the client with no warning. main fails each of these builds, router-only and Start (Vite): its generator adds an import of createFileRoute from the router package to the route file on disk, and the duplicate binding stops the build. Fix: import createFileRoute from the framework's router package.

    import { createFileRoute } from '~/lib/router' // not recognised
    import { createFileRoute } from '@tanstack/react-router' // fix
  • A value import used only in types is in no output under verbatimModuleSyntax once the code naming it is split; main loads it. A module imported for its side effects needs import './x'.

  • A const the source reads only in types is removed when split code reaches it, and its initialiser doesn't run; main runs it. A class, enum or namespace that removed and kept code both name only in types leaves with the removed code. Fix: read it by value from code that stays.

  • A var declared inside a top-level statement that a split option reads runs when the route loads; main runs it when the chunk loads.

  • In a route file with a value export * from …, a target's export named tsr$<name> can be shadowed: when splitting makes the route module export one of its bindings to a chunk, the glue name is tsr$<name>, and the module's own export wins over the star's. main has no glue exports. No corpus route file has such an export. Fix: don't give tsr$-prefixed exports to a module a route file star-re-exports.

  • function Unused() { return <Page/> } keeps Page eager when Page isn't a plain function with effect-free imports: code nothing uses stays for the bundler. main has Page only in the chunk.

  • Route files under node_modules aren't split, on Vite, webpack and Rspack, with one warning per file: a physical() mount of an installed package, or a routes package resolved with resolve.preserveSymlinks. main splits them. A pnpm or Yarn workspace's routes package resolves to its real path and is split as before. On Vite this keeps dependency modules out of the router plugin's transform (peak RSS under Losses).

  • Deterministic webpack and Rspack module ids change once with this release, for app and dependency modules. The code doesn't change.

    • The router plugin's own loader is now in the request of every app module outside node_modules, and of no dependency module. main put unplugin's loaders in every module's request, dependencies included.
    • Under pnpm or Yarn PnP, where the loader's path holds the plugin's version, app module ids then change with each update of the plugin. On main the requests hold unplugin's loader path instead.
    • Run on both bundlers with the same dependency paths on both sides: from main to this PR, every compared app and dependency module got a new id. With only the router plugin's install path moved, every app module's id changed here and none did on main.

<Hydrate>

  • More refusals (the build fails at the code; split={false} keeps the boundary in place). main builds them and the split children work on a copy or a snapshot:

    function Page() {
      let label = 'a'
      label = 'b'
      return (
        <Hydrate when={visible()}>
          {/* build error: a hook called through a member */}
          <p id={React.useId()} />
          {/* build error: a function reading a `let` the component reassigns */}
          <button onClick={() => log(label)} />
        </Hydrate>
      )
    }
    • React: a child calling a hook through a member (React.useId(), Route.useLoaderData()). Move the call into a child component.
    • React: React's use written directly in the children, use(Context) and use(promise) alike (also renamed, or as React.use). On main the call moves into the split component, where use(Context) reads another context than on the server (a hydration error). The error points at the call, for every hook.
    • React: a function in the children reading a let the component reassigns, also through a nested <Hydrate>. Use useRef.
    • Children assigning a local of the component, or a module-level binding other code of the module also uses.
    • new.target in the children, and a nested Solid boundary assigning an outer local through ref.
  • Split children passing arguments as a shorthand property ({ arguments }) get the key tsrArguments (React: a hydration error) or fail to parse (Solid). main renders them. Pinned, below; write { arguments: arguments }.

  • A hook only a <Hydrate fallback> reads is dropped on the server in every file. main keeps it outside a route's split component. A browser-only hook no longer crashes the server render; a hook taking an id (useId, Solid's createUniqueId) shifts the ids after it, as with <ClientOnly> children on main. Fix: call the hook in a component inside the boundary.

Import protection

  • allowImport(info) decides, onViolation(info) reports (breaking).

    tanstackStart({
      importProtection: {
        // decides: `true` gives the import the real module, with no report
        allowImport: (info) => info.importer.endsWith('/src/lib/analytics.ts'),
        // reports only: returning `false` no longer allows the import
        onViolation: (info) => report(info),
      },
    })

    Returning false from onViolation no longer allows an import: the import gets the normal outcome and Start points to allowImport. On main, false silenced the report; a marker file then shipped for real and a .server file stayed mocked. allowImport runs once per import before the mock replaces it, in dev and builds; true gives the real module with no report. Its info has no trace or snippet.

  • An importer that exclude or ignoreImporters exempts gets the real module of a denied file it imports plainly. main gave it the mock, silently. This is what the exemption means, and it does put that file in the client.

  • Importers that disagree fail the build, on Vite and Rsbuild, under both behaviours: one importer needs a denied file as it is (exempt, or allowed) while a checked module reaches the file itself (a pattern import, or an import another plugin added). main built it on Rsbuild and on Vite with mock. The error names the file, both importers and the two fixes.

  • Rsbuild builds with error fail on pattern imports of a denied file (template import(), import.meta.webpackContext) and on a denied import in a worker built by a child compiler. main mocked both silently.

Route generation

  • routeTree.gen.ts formatting changes once. The file is printed in your quoteStyle/semicolons, and enableRouteTreeFormatting now defaults to false (true uses Prettier, loaded lazily). If a formatter runs over the file, ignore the file or set the option to true; otherwise the generator and the formatter rewrite each other's output.
  • Router-only builds fail on a route tree error (two files for one route, conflicting paths, a missing root route) or a route file that doesn't parse, naming the files. main built with the tree on disk, without the route. Start builds and tsr generate already fail on main. Dev and watch report the error and keep the last good tree.

Dev servers and HMR

  • A page that loaded with a split chunk already throwing reloads once on the fixing edit. main recovers in place on Rsbuild with React and on Solid, and stays stuck on the error on Vite with React. State is fresh on both sides.
  • React on Vite: an edit that only changes codeSplitGroupings resets the component's state; main keeps it.
  • Vite: a plugin that regenerates a virtual module without telling Vite leaves Start's compile of the module's importers on the old text until a restart: the module isn't in a hot update, and its load didn't addWatchFile the edited file (for example invalidateModule and a full-reload from the plugin's own watcher). In Vite bundled dev and with server.hmr: false there is no hot update to read, so any regeneration is missed there. main doesn't read a virtual module's exports, so its compile doesn't depend on them.
  • Rsbuild dev source maps. In a live session, DevTools keeps the previous text after an edit that changes no output's code (a comment, a type), until a reload. main shows it, because it hot-updates every output of the file on every edit; that is the widening the narrow hot updates avoid. A reload or a new tab shows the current text. The server environment's maps hold the text only when Rsbuild writes them to disk (dev.writeToDisk).

Packages and APIs

  • Peer floors (router-plugin's ranges are unchanged):

    peer was now
    vite ≥ 8.0.0 ≥ 8.1.0
    @rsbuild/core ^2.0.5 ^2.2.13
    @rspack/core, for react-start-rsc ≥ 2.0.0-0 ≥ 2.2.9
  • @babel/core no longer comes with the router plugin or Start: declare it if a plugin of yours needs it (e.g. React Compiler).

  • Removed:

    • Start's experimental compilerTransforms, serverFnProviderModuleDirectives and StartCompilerPlugin;
    • react-start-rsc/plugin/rscCssTransform, replaced by rsc: { loadCssExpression, providerDirective };
    • ssrIsProvider of TanStackStartCoreOptions;
    • router-utils' Babel helpers;
    • router-generator's format, inferFullPath, checkRouteFullPathUniqueness, writeIfDifferent and afterTransform, and the Generator's undocumented fs option (it reads and writes route files directly). onRouteTreeChanged now receives { model, generator }.
  • The router plugin context must come from createRouterPluginContext() (@tanstack/router-plugin/context), imported in the same module format (ESM or CJS) as the plugins. A hand-built { routesByFile: new Map() }, or a context from the other module format, throws when the plugin is created, with an error naming the factory. main accepted both.

  • New entries: @tanstack/router-utils/compiler (internal, no semver), @tanstack/router-core/tooling, @tanstack/router-plugin/planners, and the dev-only @tanstack/router-core/hmr and @tanstack/{react,solid,vue}-router/hmr.

  • Examples: the WorkOS example uses @workos/authkit-tanstack-react-start ^0.12.0 (0.5.0 calls .inputValidator()).

Better than main

Items that begin with Fails the build stop a build that main lets through on at least one bundler.

Start: server functions, builders, erasure
  • Fails the build: a builder the compiler can't follow, at the use, with the fix (in dev the module fails, with the overlay). main built these and shipped the handler to the client in most of them (16 of 21 shapes run):

    wrap(createServerFn()).handler(fn) // passed to a function
    const builders = { post: createServerFn() } // stored in an object
    const handler = createServerFn().handler // a method read off a builder
    const make = (h) => createServerFn().handler(h) // a parameter passed as server code
    const serverOnly = (fn) => createServerOnlyFn(fn) // the same
    • a builder or factory passed to a function, stored in an object, array or class field, awaited, destructured, or a JSX prop;
    • a method read off a builder: const h = createServerFn().handler, .call, .bind, an unknown method;
    • a factory with control flow (an if with two returns, an async function, a method, a getter), a let builder reassigned with something else, a builder in a TS namespace, a project namespace passed around when its module exports a builder;
    • a parameter passed directly as server code: (fn) => createServerOnlyFn(fn), ({ handler }) => createMiddleware().server(handler).
  • More builder shapes compile. On main their handlers shipped to the client: const { createServerFn } = Start, (0, createServerFn)(), a builder chosen by ?:, ??, || or &&, a factory with statements before its single return, export * as ns, a factory two export * branches reach under two names of one binding (export { api as a, api as b }), a factory exported as '*'.

    const { createServerFn } = Start
    export const a = (0, createServerFn)().handler(fn)
    
    const base = isPost ? createServerFn({ method: 'POST' }) : createServerFn()
    export const b = base.handler(fn)
    
    function make() {
      console.log('make') // statements before the single `return`
      return createServerFn()
    }
    export const c = make().handler(fn)
  • A server fn that isn't a top-level declaration builds, in every position evaluated exactly once when the module loads: an object or array entry, a call argument, export default, an assignment's right-hand side, a member's object, a class's static field or block, a top-level await. On Vite, main fails all of them (createServerFn must be assigned to a variable!); on Rsbuild, main builds them, ships the handler to the client and registers nothing.

    export const api = { getX: createServerFn().handler(fn) } // an object entry
    export default createServerFn().handler(fn)
  • Fails the build: a server fn in any other position (a function body, a condition, a loop, an instance field, a Vue <script setup> block), naming the position and the fix: define it at the top level and pass what it needs in its input. On Vite these fail on main too, without the position; on Rsbuild main shipped the handler; in <script setup> on Vite main built and the call failed at runtime.

  • One instance per server fn (SSR as the provider): the handler imports what its file keeps, so module state exists once and a class passes instanceof (fix(start): share module bindings between server function handlers and their module #8656). The handler and what only it uses still load on the first call.

  • Server code can call a server fn the client never imports (Server functions that are stored in a separate file cause middlewares to throw error #7213, "Server function info not found" when calling a server function that's *only* called on the server #8731). On main that call fails with Server function info not found.

  • Production answers HTTP calls only for server fns the emitted client bundle still calls, on Vite and Rsbuild, with and without RSC. On main a server fn private to a module the client imports (a helper only another handler calls) answers a direct HTTP call by its id, which anyone with the source can compute. Server code still calls it.

  • An exported server fn the client never uses leaves the client bundle and isn't callable over HTTP (Vite, except with build.minify: 'esbuild'; Rsbuild, except with output.minify: false; see Not guaranteed). The code of its chain (options, middleware arguments) still runs. On main its stub stays in the client bundle and the server fn answers. The stub is now one pure-annotated call of a helper of ours, which costs +5…+19 B gzip once (under Losses).

  • An env-only or isomorphic function called at once with a method (createClientOnlyFn(obj.method)()) calls the method detached ((0, obj.method)()), as the function the factory returns does. main calls it with obj as this.

  • createServerOnlyFn(…) or createIsomorphicFn() written in place as a handler works (If you pass createServerOnlyFn(...) directly as an argument to createServerFn().handler(), it will generate a broken server function. #8446); on main the whole app answers 500.

  • A class, enum or namespace only server code uses leaves the client, with its imports, and so does a declaration that removed code names only in a type (typeof cfg). main keeps them, so their imports stay in the client bundle.

  • A parameter only read inside server code ((role) => createMiddleware().server(() => check(role))) gets one warning: what callers pass for it ships to the client, as on main, which says nothing.

  • Kits that list Start under dependencies are compiled on the Vite server, like peer kits. On main their server fns return undefined during SSR.

  • vite build --watch: the server builds after the client's first build, so the first build answers server fns (on main it answers none), and a server fn the client stops importing stops being callable after the rebuild. The two watchers are tied by a file in a per-run directory under the system's temporary directory; a build.watch.exclude matching it isn't supported.

  • Vite dev: a request for a server fn the dev server hasn't compiled yet (a page left open across a restart) compiles its file, when the file is inside srcDirectory, outside node_modules and allowed by server.fs (start-plugin-core: the dev server-fn id validator's recovery can never succeed — it transforms under the one flag that skips the compile #8447). A server fn an edit removes answers Invalid server function ID instead of a TypeError. The dev server may warn when it has compiled no client code calling a server fn yet; the warning is a hint, not the production check.

  • Dev servers: a module that imported a file that didn't exist yet loads it once the file exists; main kept failing until a restart. With server.hmr: false (Vitest), a module whose import became a server-fn builder is recompiled; main kept the handler in the client module.

  • Fails the build (RSC): renderServerComponent or createCompositeComponent outside a server function, at the call. On main it built and threw at runtime. Server fns that only a 'use client' module imports are in the production manifest (Start RSC mode: server functions imported only from 'use client' modules are missing from the production manifest ("Server function info not found") #7943).

  • RSC CSS through conditionals: a server component passed to renderServerComponent, createCompositeComponent or renderToReadableStream through ?:, &&, || or ?? gets its CSS on each operand that can be the JSX rendered. main adds the CSS only to a JSX argument written directly.

    renderServerComponent(isAdmin ? <AdminCard /> : <Card />) // both styled
    renderServerComponent((isNew && <NewBadge />) || <Badge />) // both styled
  • Rsbuild:

    • server-only routes are pruned from the client route tree (Start + Rsbuild: server-only routes are not pruned from the client route tree #8545);
    • Vue SFC script blocks are compiled with @rsbuild/plugin-vue (main fails the build of an SFC that imports Start);
    • a server fn only a worker built in a child compiler calls is registered;
    • with performance.buildCache, a build after an edit names the new client entry (on main every page links the previous build's entry and never hydrates).
  • A route whose server handlers are in its route file and whose page is in its .lazy file stays in the client route tree, on Vite and Rsbuild, so client-side navigation reaches it. On Vite, main prunes it.

  • Symlinked route files are compiled: their server handlers are removed from the client (Start: symlinked route files skip the client-side server.handlers strip — server code and node-only imports ship in the client bundle #8514), they split, and the document links their split chunks' CSS. main serves them as written. When two route files link to one file, the generator gives the second its own file, as on main, and both routes load.

  • Under Start, while route generation has never succeeded (a dev server started with a route file that doesn't parse), a module exporting Route fails with the generator's error. main served it as written, its server code included.

  • Start's Vite plugin order no longer matters for React: tanstackStart() may come after @vitejs/plugin-react, where main fails with a plugin-order error. Solid still needs tanstackStart() first, as on main.

Route files and code splitting
Route generation
  • @tanstack/router-plugin/esbuild generates the route tree at each build start and rebuild. On main an app without a committed tree fails to build.
  • A route id that isn't a string literal builds with a warning (Route generation does not allow plain template literals anymore after 1.166.31 #7216); on main it fails route generation and the build. '/x' as const is kept in sync.
  • The generator repairs constructors: a root constructor in a route file becomes createFileRoute(path), and createFileRoute in __root becomes createRootRoute.
  • A leading // @ts-nocheck, // @ts-check or /// <reference …/> stays first when the generator adds the router import to a route file. main puts the import above it, and TypeScript then ignores the directive.
  • The tree is rebuilt from the files on every change: deleting a layout keeps its children, a deleted routeTree.gen.ts is written again, and edits of the virtual route config and of __virtual.ts files are picked up. On main each of these leaves a stale tree under tsr watch.
  • Empty .ts route files get a scaffold without JSX (Empty .ts route file is scaffolded with JSX, breaking all route generation #8480). .lazy.vue files and route.component.vue pieces belong to their route.
  • tsr watch and the Rspack and webpack plugins watch every route root, physical() mounts included, and vite build --watch picks up new route files. Sibling physical() mounts no longer declare one identifier twice (router-generator: sibling physical() subtrees in a virtual route config generate duplicate identifiers #8879).
  • Writes survive a tmpDir on another filesystem (EXDEV on main) and a deleted .tanstack/tmp (git stash -u); on main every later route change fails until a restart.
  • A root route file that doesn't parse fails tsr generate; main exits 0 and writes the tree.
  • One generator run per Start Vite build instead of three, and Prettier isn't loaded unless formatting is on (router-generator: lazy-load Prettier (costs ~300–450ms per build even when formatting is off) #8887).
<Hydrate>, import protection, HMR, diagnostics

<Hydrate>

  • <Hydrate> imported through the app's own re-exports (a barrel, export *, a namespace import) splits its children. A renamed re-export, or one through a package, stays unsplit.
  • Solid children may call use*() functions directly and are split; main fails the build on a bare useX() call.
  • await or yield directly in the children, and a read of a private name of the enclosing class (this.#label), fail with a message instead of a parse error.

Import protection

  • An import of a denied file that tree-shaking removes no longer fails the build (Vite and Rsbuild). An unused import of a denied file with top-level side effects (a development-only guard included) is still reported, on both sides: loading it would run them.
  • The suggested fix fits the import: <ClientOnly> for a component rendered on the server (for a component a route option renders, a wrapper passing the router's props on: errorComponent: (props) => <ClientOnly fallback={...}><Oops {...props} /></ClientOnly>), createClientOnlyFn for a function. main prints a generic hint. A marker violation names the position of the marker import (src/count.ts:3:8).
  • Vite builds report every violation, not only the first. Mock mode says "Import mocked". A pattern import's report names the pattern and its position and suggests a ! exclusion. On Rsbuild, traces start at the app's first file instead of Start's client entry.
  • The Vite dev server reports the pattern imports it mocks; main is silent.
  • On Vite, ?raw of a file with a server-only marker serves the mock; main ships its text.
  • A build warns once about each denied file it mocks whose every importer is exempt or outside the scope. Both sides mock; main is silent.
  • In production builds, a mocked value reports its use at runtime; on main it is silent.
  • Dev heap: Start: import protection keeps a parsed AST per module in dev (hundreds of MB in large apps) #8614 (numbers under Performance).

Route HMR

  • React: an edit always shows. const Page = flag ? Wide : Narrow and a layout import switched to another module are stale on main until a reload. The router takes the new component after React Refresh's pass, and React Refresh alone decides whether state survives.
  • Solid: the same two shapes show, where main is stale. Split chunks carry the route file's @refresh pragmas, so a split component keeps its state under @refresh granular. After a rename or a removed component in a split route, later edits need a reload (pinned, Renaming a component causes an endless HMR invalidate loop on webpack/Rspack solidjs/solid-refresh#88).
  • Lazy route files (*.lazy.tsx) update in place, with React state; main reloads the page. The page still reloads, as on main, when an edit removes an option the route loaded from the lazy file, and when the router the page created last has its own route of that id without the lazy file.
  • On Rspack, an edit of a split loader refreshes the route; on main the page keeps the old loader's data.
  • Vue: an edit of a route file keeps the component of its *.component.vue file. On main the page goes blank until a reload.
  • An update patches only the route its module exported, so another router in the same window is left alone ([Vite plugin][Module Federation] Multiple routers in the same window cause an Invalid Hook Call when the remote uses @tanstack/router-plugin — regression in 1.168.17 #7921).

Diagnostics

  • Messages name files relative to the project root, carry one position and a [tanstack-router] or [tanstack-start] prefix. main prints e.g. createServerFn must be assigned to a variable! with neither. On Rsbuild, Rspack and webpack the position is the compilation's own (File: ./src/routes/x.tsx:3:23) instead of :1:1.
  • Invalid split groupings fail with one error naming the value.
  • A plugin that gives a route file different text under different module ids gets a warning.
  • Internal checks: a client module that would hold recognised server code, or an output that would copy text the compiler rewrites, fails the build with an internal error naming the file. These mean a compiler bug.

Not guaranteed (as on main)

  • Plain code the client also reads: a server-side call in a declaration the client reads isn't chased, and what callers pass as a parameter ships. Write server code inside the primitives.
  • Routes the router didn't make: a Route from an app's own helper, or a file the generator doesn't list, is served as written; under Start its server, ssr and headers ship to the client. The same holds for what unreadable route options hold.
  • Dynamic loading of Start objects: import(), require() and import.meta.glob neither fail nor warn. Keep builders statically analyzable.
  • Other tools and APIs: modules other plugins generate or rewrite, Vite's worker build, Route.update(), code-based createRoute({ server }), and a file read on purpose as text.
  • Import protection: rules read names and what an in-scope importer writes. An importer outside the scope gets the mock, and the forms in the "Not covered" pin row reach the client.
  • Source maps: published maps hold your source.
  • Copies, as main makes them:
    • a <Hydrate> chunk copies the module-level declarations its children reach, so a context, a store or a reassigned let exists twice (ten shapes in KNOWN-BUGS);
    • a split chunk that reads a class, enum or namespace copies it;
    • a split chunk's caller copy of a server fn builds the chain's root and middleware again;
    • a split option reads its chunk's copy of a module let or var that code staying in the route module assigns, so it can read a stale value (every split option alike: an arrow, a method or an object-form handler).
  • A value both staying code and a split option read goes into the route's shared module, which loads before the route module. If computing it reads Route through an import cycle, the page fails to load (on webpack Cannot access 'Route' before initialization).
  • Server-fn stubs a bundler keeps: with Rsbuild's output.minify: false or Vite's build.minify: 'esbuild', the stub of an exported server fn the client never uses stays in the client bundle, and the server fn stays callable over HTTP. So does a stub a user call continues (….handler(fn).bind(x), left unannotated so the user's call keeps its effects), and one that client code calls only in a branch the bundler doesn't remove (a constant if (false) is removed by the default minifiers).
  • Primitives under another name: re-exporting Start's primitives (createServerFn, createIsomorphicFn, …) under another name, or the whole router package from a package of your own (see the re-exported createFileRoute above), isn't a supported pattern. A renamed Start primitive is compiled where the compiler can follow it, but on the Vite dev server a module that imports it from a virtual module can keep its previous compile when that virtual module switches between a primitive and an ordinary function, until a restart. main doesn't follow the rename and ships the server implementation.
  • An imported loader object (loader: loaderObject from another module) splits whole when the loader is split, and breaks at runtime. Write the object in the route options.
  • vue-loader set up through tools.rspack: the SSR build fails for a .vue whose <script> defines a server fn. @rsbuild/plugin-vue works; main fails every Start .vue on Rsbuild.
  • Route CSS is eager and root routes aren't split.

Follow-ups

Upstream issues filed

One line per issue; GitHub shows each one's state. A note stays only where the state doesn't tell what users get.

Yuku: 28 filed. The PR pins Yuku 0.29.0, which has every fix. yuku-toolchain/yuku#290 was closed because its fix is deferred to Yuku's upcoming transformer; we don't need it.

All 28 Yuku issues

Vite:

Rolldown:

Rspack:

Rsbuild:

SWC (Rsbuild's transform):

solid-refresh:

chokidar:

Others:

Issues

Each of these was reproduced on main 0b6d4f3f6b and run again on this branch, except five:

Other issues:

Supersedes #8459, #8504, #8630, #8721, #8773, #8756, #8755, #8732, #8686, #8682, #8681, #8061, #8493, #8481, #7892, #8515, #7281, #8797, #8662, #8296, #8215, #8454, #8276, #8675, #8540, #8523, #8524, #8680, #8684, #8749, #8801, #7338, #8798, #8818, #8899, #8832, #8656, #7925, #8799

Supersedes in part (what is still missing):

Implementation obsolete (needs a re-port after merge): #8804, #7693, #7766, #7872, #8291, #8842, #8833. In part: #8293 (the prerender-env wiring and build-time stripping), #8277 (its route-HMR half is superseded; the rest applies as a normal PR), #6748 (startInstance.createServerFn(…) needs one recogniser entry and a test), #8882 (only its Vite start-router-plugin piece), and #8845 and #8877 (stacked on #8842; a restack only).

Still apply after a rebase: #8800 (3 small conflict hunks), #8880 (only deleted snapshot fixtures conflict), #8057 (mechanical: re-run the migration). #8256 is overtaken by main and could be closed.

How to review

The diff against main is 2,344 files. Tests and the test harness are 1,686 of them (the oracle from compiler-tests/baseline, plus this PR's suites), and regenerated route trees are another 198. Product code is 249 files in packages/*/src.

  1. Core: start with router-utils/src/compiler/README.md, then read identity → source/analysis → units/mutation → rewrite → placement (with clusters and reads) → plan → emit → values/summary/facts → cache/pipeline → verify. Keep tests/helpers.ts and tests/placement.test.ts open alongside.
  2. Planners:
    • Router: router-plugin/ARCHITECTURE-CODE-SPLITTING.md, then src/planners/.
    • Start: start-plugin-core/src/planners/ (start-env, hydrate, rsc-css, edges), with src/compiler/, src/server-fns/ and src/import-protection/. Builder escapes: ESCAPE_MESSAGES in start-env.ts and tests/start-compiler-builder-shapes.test.ts.
  3. Hosts:
    • router-plugin/src/hosts/.
    • Start's src/vite/compiler-plugin.ts.
    • Start's src/rsbuild/ (read COMPILER_ARCHITECTURE.md first).
  4. Generator and runtime:
    • router-generator (AGENTS.md, analyze/, model/, print/).
    • router-core/src/hmr.ts and {react,solid,vue}-router/src/hmr.ts; solid-router/src/hmr-chunk-importer.ts is the temporary Rspack workaround.
  5. Tests: the oracle's README.md, SPEC.md and KNOWN-BUGS.md.

To reproduce the measurements, see:

  • packages/compiler-test-utils/oracle/README.md
  • benchmarks/compiler-perf/README.md
  • pnpm benchmark:bundle-size:run
  • scripts/benchmarks/bundle-size/server.mjs

This PR was written with AI assistance: Claude Code agents working under a human architect. Their work was checked against the oracle, e2e, perf and bytes gates above.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
Pre-merge checks: Inconclusive 2

Failed Failed checks: 2 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Description check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@changeset-bot

changeset-bot Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f26bfaa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 25 packages
Name Type
@tanstack/start-plugin-core Minor
@tanstack/react-start Minor
@tanstack/solid-start Minor
@tanstack/vue-start Minor
@tanstack/react-start-rsc Minor
@tanstack/router-cli Minor
@tanstack/router-generator Minor
@tanstack/router-plugin Minor
@tanstack/router-vite-plugin Minor
@tanstack/router-utils Minor
@tanstack/router-core Minor
@tanstack/react-router Patch
@tanstack/solid-router Patch
@tanstack/vue-router Patch
@tanstack/start-client-core Patch
@tanstack/compiler-test-utils Patch
@tanstack/react-start-client Patch
@tanstack/react-start-server Patch
@tanstack/solid-start-client Patch
@tanstack/solid-start-server Patch
@tanstack/start-server-core Patch
@tanstack/start-storage-context Patch
@tanstack/vue-start-client Patch
@tanstack/vue-start-server Patch
@tanstack/start-static-server-functions Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@socket-security

socket-security Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

@nx-cloud

nx-cloud Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit f26bfaa

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 11m 39s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 38s View ↗

💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-11-26 18:46:06 UTC

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

15 package(s) bumped directly, 10 bumped as dependents.

🟨 Minor bumps

Package Version Reason
@tanstack/react-start 1.169.7 → 1.170.0 Changeset
@tanstack/react-start-rsc 0.1.68 → 0.2.0 Changeset
@tanstack/router-cli 1.168.0 → 1.169.0 Changeset
@tanstack/router-core 1.171.39 → 1.172.0 Changeset
@tanstack/router-generator 1.168.0 → 1.169.0 Changeset
@tanstack/router-plugin 1.169.0 → 1.170.0 Changeset
@tanstack/router-utils 1.163.0 → 1.164.0 Changeset
@tanstack/router-vite-plugin 1.167.49 → 1.168.0 Changeset
@tanstack/solid-start 1.169.7 → 1.170.0 Changeset
@tanstack/start-plugin-core 1.172.0 → 1.173.0 Changeset
@tanstack/vue-start 1.169.7 → 1.170.0 Changeset

🟩 Patch bumps

Package Version Reason
@tanstack/react-router 1.170.46 → 1.170.47 Changeset
@tanstack/solid-router 1.170.43 → 1.170.44 Changeset
@tanstack/start-client-core 1.170.39 → 1.170.40 Changeset
@tanstack/vue-router 1.170.42 → 1.170.43 Changeset
@tanstack/compiler-test-utils 0.0.0 → 0.0.1 Dependent
@tanstack/react-start-client 1.168.45 → 1.168.46 Dependent
@tanstack/react-start-server 1.167.52 → 1.167.53 Dependent
@tanstack/solid-start-client 1.168.42 → 1.168.43 Dependent
@tanstack/solid-start-server 1.167.50 → 1.167.51 Dependent
@tanstack/start-server-core 1.169.45 → 1.169.46 Dependent
@tanstack/start-static-server-functions 1.167.44 → 1.167.45 Dependent
@tanstack/start-storage-context 1.167.41 → 1.167.42 Dependent
@tanstack/vue-start-client 1.167.45 → 1.167.46 Dependent
@tanstack/vue-start-server 1.167.50 → 1.167.51 Dependent

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: 5b31c2a7b681
  • Measured at: 2026-11-26T18:35:02.510Z
  • Baseline source: history:ce46b21b901f
  • Dashboard: bundle-size history

The following scenarios have bundle-size changes compared with the baseline:

Scenario Current (gzip) Initial (gzip) Raw Brotli Trend
react-start.full 99.9 KiB
0 B
99.7 KiB
-2 B
311.7 KiB
+17 B
86.7 KiB
-5 B
▂▂▂▂▂▂▁▁███
react-start.rsbuild.minimal 96.6 KiB
-36 B
96.5 KiB
-35 B
298.2 KiB
-95 B
83.5 KiB
+42 B
███▁▁▁▁▁▁▁▁▁
react-start.rsbuild.minimal-iife 97.0 KiB
-28 B
96.9 KiB
-28 B
299.2 KiB
-95 B
83.9 KiB
+61 B
███▁▁▁▁▁▁▁▁▁
react-start.rsbuild.full 99.9 KiB
-25 B
99.8 KiB
-24 B
307.9 KiB
-83 B
86.2 KiB
+145 B
███▁▁▁▁▁▁▁▁▁
solid-start.full 51.2 KiB
+3 B
51.1 KiB
+3 B
150.1 KiB
+12 B
45.4 KiB
+10 B
▁▁▁▁▁▁▁▁████
vue-start.full 69.2 KiB
+3 B
69.0 KiB
+2 B
197.6 KiB
+12 B
61.5 KiB
-147 B
▁▁▁▁▁▁▁▁████

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@Sheraff

Sheraff commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator Author

🤖 Written by Claude (AI) at the maintainer's request; numbers are from this PR's perf harness and CPU profiles, reviewed by a human.

Headroom after this PR. How much time a faster compiler could still win, and where the rest goes.

338-route Start apps and 333-route Router apps, median ms of 7 runs at 0c3f86ecb9. Real and floor come from the same run. The floor replays every compiler output, so it is what a zero-cost compiler would take (0 replay misses, same output as the real run). Ours = real − floor, with its bootstrap 95% CI.

app build real / floor / ours dev cold → / hydrated dev compile-all
react-start 1,433 / 697 / 736 [728, 749] 2,349 / 1,567 / 783 [605, 817] 1,937 / 989 / 948 [880, 985]
react-router 582 / 400 / 182 [146, 188] 1,075 / 907 / 168 ¹ 1,271 / 940 / 331 [281, 372]
solid-start 4,192 / 3,512 / 680 [371, 923] 3,457 / 2,354 / 1,103 [794, 1,550] 4,734 / 3,684 / 1,051 [841, 1,157]
solid-router 1,987 / 1,842 / 145 [96, 177] 1,474 / 1,300 / 174 [164, 201] 4,114 / 3,597 / 518 [409, 590]

¹ Three of the seven floor runs read 1.27–2.08 s (a load blip), so the CI says nothing here; the other four read 880–907 ms.

Compiler-only work can still win at most ~0.15–0.5 s on Router and ~0.7–1.1 s on Start, for React and Solid alike. Solid's floor is 1.4–5× React's because of vite-plugin-solid's Babel pass, which we don't own. Anything bigger means making the bundler do less.

HMR against main

Medium and large apps, 0c3f86ecb9 vs main 0b6d4f3f6b:

  • Route edits are 16–53% faster on Vite and 29–39% faster on Rsbuild. Server-fn edits are 39–79% faster and <Hydrate> edits 10–68% faster.
  • Loader edits are faster on Solid (−14 to −48%) and Rsbuild (−34 / −42%), and at parity on the large React apps. At 0c3f86ecb9 they were slower on the three medium React Vite apps (+8 to +10 ms, +14 to +35%), because an options-only edit waited for React Refresh's next pass.
    • Now a route module that holds no component skips that wait. Against the head before the change, on medium Vite apps (4 paired rounds): react-start loader edits are −28.6% (64.7 → 46.1 ms; main read 57.8 in the matrix run), and react-router −57.5% (33.9 → 14.4 ms; main 25.9–33.4) on a route without a pendingComponent.
    • A route that keeps a component in its module still waits: an unsplit route, or an unsplit pendingComponent (not in the default groupings; about 30% of the generated routes have one). There the loss stands.
    • The price: component edits of a route whose only component is split are +1.9 ms on react-router (+6.8%), still ahead of main.
  • Our SSR hotUpdate now compiles the route module only when a derived module of the update needs it: 1.80 → 0.18 ms per call on react-start Vite medium, and route component edits −3.3%.
  • Rsbuild rebuilds the client manifest from every chunk on each edit: 52 ms at 481 chunks and 260 ms at 2,093 (of a 605 ms edit; profiles at c99ee06725), the same on main. Replaying an unchanged manifest gives at most −38.7% on a shared edit, but a sound "graph unchanged" test needs Rspack's own change set or our knowledge of the edited modules; ask Rspack first.
  • Shared-module edits don't grow with app size: React Start is 23.8 / 24.1 / 23.4 ms small → large, against main's 23.9 / 24.5 / 25.1.
    • Below main: React Start large (−1.75 ms [−2.10, −1.40]) and Solid Start large (−0.90 ms [−1.30, −0.35]).
    • Above main: Solid Router (small +0.80 ms [0.60, 1.10], large +0.60 [0.25, 0.80]), small Solid Start (+0.95 ms [0.60, 1.30]), and small and large React Router (+0.40 [0.15, 0.60], +0.45 [0.00, 0.90]). On an edit, our hotUpdate re-checks the plans of the edited module's importers before Vite sends the update (0.43 ms per edit on Solid Router).

Where the Start second goes

react-start, dev compile-all, main thread, 3 profiles at 100 µs: compiler stacks take 659 ms of 2,238 ms busy; GC, counted apart, is 220 ms. Of the 659 ms:

  • the core (router-utils): 315;
  • Yuku: 149;
  • Start planners and host (start-plugin-core): 73;
  • the route planner (router-plugin): 25;
  • the generator: 18;
  • Rolldown/Vite resolver code called from ours: 36;
  • other libraries: 17 (zod 9, pathe, picomatch);
  • Node built-ins: 26 (hashing 8).

By phase, as a share of that time:

  • parse + analysis + header + units 22%;
  • placement 10%, planners 10%;
  • freeze 7%, resolution 7%;
  • facts 6%, prefetch 6%, import-protection edges 6%;
  • generator 5%, emit 3%, server-code check 0.7%.

Solid Start has the same split (737 ms; Yuku 151, core 355, Start 97). React Router spends 364 ms (Yuku 94, core 198, route planner 33). Sync time in our hooks is ~30 ms over 1,921 transform calls; the compile work runs after the hooks' first await, and much of that wait is resolutions.

Dev startup

  1. Lazy route modules (router-core + generator, not the compiler). Loading / transforms every route file because the generated tree imports them all (488 client + 469 SSR modules, ~1.35 s of bundler time even with a free compiler, when first measured). The idea: a tree whose unmatched routes carry only path info and import() their file on first match. Est. 2.3 s → 0.7–0.9 s (react-router 1.1 → ~0.4). It would also connect the dev client earlier: Start's dev entry imports /@vite/client statically, so HMR connects only once the whole route graph is fetched. Effort high (match-time loading, types, Start manifest, HMR); risk: pathless and beforeLoad-only ancestors.

  2. Resolve less. Start's value prefetch resolves every value-referenced import through the bundler's resolver, and import protection resolves every edge: ~8.4k distinct resolutions per compile-all. A Vite resolveId settles in ~0.07 ms, so first-time resolutions sum to at most ~0.6 s of async time, mostly overlapped. The per-call cost on the bundler side is its async bridge, not a defect, so nothing is filed upstream for it. Count and time them before building anything. Options:

    • Don't resolve bare specifiers that no alias or paths covers and that don't name a discovered Start library. On Vite they end up pre-bundled (opaque) or external (SSR) anyway.
    • A stat-probe fast path for ./ and ../, with bundler fallback and a dev-mode self-check.
    • Read target markers only when a marker-bearing file exists (index once, keep it via the watcher).

    Effort low–medium; risk: resolver plugins we bypass.

    The same cost shows on modules with nothing for Start: on 3,000 one-line modules, compiling them all is +5.4% against main with import protection on and +42.8% with it off (d5f1352c43, 8 paired rounds; about 0.14 ms per module and environment: our parse plus the prefetch's resolutions, where main's text filter skips the module). Item 5 attacks the same cost.

  3. Pre-bundle Start's late dependencies. seroval, seroval-plugins/web and cookie-es are found only while the first page is served, on main too, so the optimizer re-runs (~0.75 s when measured on Vue). Adding them to the client optimizeDeps.include avoids that on the first start and after a lockfile change. Effort trivial; verify first that it is on the hydration critical path for React and Solid.

  4. Listen is ~211 ms on react-start medium (main: 623 ms). The generator and the plugin import are most of it; at most ~30 ms is left to win. Swapping zod changes public config types in three packages.

Build / compile-all

  1. One plan for both envs when nothing env-specific happened. SSR compile-all is 837 ms real vs 433 floor. Most route files have no server code, so their SSR plan equals the client plan. Serve the second env from the first plan when it recorded no Start candidate (edge policy is already per output). Est. 200–300 ms on Start, 0 on Router. Risk: per-env resolvers; validate fingerprints under the second env.
  2. Yuku JS side (asks drafted, not filed): O(1) indexOf, index-based node views, a native side-effect query. Yuku is 149 ms of the 659. The earlier estimates predate the compiler reading file.imports[].local first, which keeps most modules from building the node → index map, so re-measure before filing.
  3. Own code. No single target stands out: placement and the planners are 10% each, freeze 7%, facts 6%. Honest total at most 50–100 ms; re-profile before picking one.
  4. Persistent plan cache across restarts. Correct by construction (plans are pure in (env, source, config, summaries) and carry dependency fingerprints), but it skips only our part, and after a restart every recorded resolution must be re-validated once, so it also pays (2). Est. −0.4 to −0.5 s on compile-all and on cold start. Better to wait for a bundler-side transform cache (Rsbuild already replays our buildInfo), which also skips oxc and React Refresh (~0.6 s of the floor).
  5. Workers / Rust: no. Sync hook time is ~30 ms; the wait is resolver round-trips, which a worker can't shorten, and summaries and registries would have to be shared. Revisit for builds only after (2).

Memory

Dev heap after GC on react-start medium is 87 MB after / hydrated and 71 MB after compile-all (main: 212 / 282). Ours is mostly plans (about 12 MB for 1,038 plans, when last measured). Next: drop the import edges from cached plans once the edge policies have read them (measured at d5f1352c43, 6 paired rounds: −4.6 MB, −6.2% on react-start medium and −8.1% on react-router medium, same output), then intern repeated dependency fingerprints and segment arrays in EmitPlan (est. −5 to −7 MB). The rest is upstream: Vite keeps module-graph nodes of deleted files (~2 KB each, vitejs/vite#23907). Rsbuild's dev file system kept every hot-update asset; that is fixed in Rsbuild 2.3.0 (web-infra-dev/rsbuild#8736).

Bytes

  • Client: at 0331deb61c, 12 of the 18 benchmark scenarios are byte-identical to main and six are 1–10 B gzip smaller (vs main 0b6d4f3f6b). In brotli, two of the six are a few bytes larger (+9 B, +4 B). Since then each server-fn client stub is one pure-annotated call of a helper of ours, so an exported server fn the client never uses leaves the bundle (about −50 B gzip each), and the helper costs +5…+19 B gzip once on a client with server fns (react-start.full +19, vue-start.full +9, solid-start.full +6 against c99ee06725; the other 15 scenarios unchanged).
  • Server: react-start.rsbuild.full is +605 B raw / +79 B gzip. The resolver imports the defining module, so Rspack loses some scope hoisting. One cache group that merges the server-fn provider chunks into the router chunk is in and recovers part of it. A __root cache group is the remaining step; the Rspack panic that blocked it is fixed in Rspack 2.3.0 ([Bug]: Panic "Chunk not found in ChunkByUkey" when a splitChunks cache group is named like a webpackChunkName chunk web-infra-dev/rspack#16289).
  • Exported route values stay eager. This PR splits what main splits: an option whose value the route file exports stays in the route module, with a warning. So a component that one route file exports and another imports (import { ProductPage } from './shop.products.$handle') is in the entry chunk, even when every user is a split component (tanstack.com: ProductPage, ~7.5 KB of initial JS when measured in October). The fix is to split an exported value through a forwarding module and point route-to-route imports straight at it. It is an improvement over main, so it was kept out of this PR. Needs a spike: HMR identity, the warning, Rsbuild and webpack.
  • Route CSS stays eager, as on main; fully lazy route CSS needs a per-route asset loader in router-core. Root routes stay unsplit: splitting their error and not-found components cost SSR CPU, and the manifest preloaded that chunk on every page anyway. A route file's shared module (?tsr-split=shared---…) costs one request; a route-aware advancedChunks hint trades requests, not bytes.

Since the first version of this comment

  • Done: one compile-scope rule for the Vite and Rsbuild hosts (a dependency is compiled only if import protection's scope includes it or its text names a Start API), and one route generation per Vite Start build instead of three.
  • Dropped: treating effect-free built-in constructors (new Map(), Intl.* formatters) as pure. Splitting no longer asks whether an initialiser has effects: code only one split option uses moves into its chunk, initialiser included, as on main.

@pkg-pr-new

pkg-pr-new Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@8817

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@8817

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@8817

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@8817

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@8817

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@8817

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@8817

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@8817

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@8817

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@8817

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@8817

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@8817

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@8817

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@8817

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@8817

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@8817

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@8817

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@8817

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@8817

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@8817

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@8817

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@8817

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@8817

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@8817

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@8817

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@8817

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@8817

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@8817

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@8817

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@8817

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@8817

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@8817

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@8817

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@8817

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@8817

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@8817

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@8817

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@8817

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@8817

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@8817

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@8817

commit: f26bfaa

@codspeed

codspeed Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

2 warnings

⚠️ 48 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ 2 benchmarks with a significant change ran on different hardware

Their base and head results were measured on machines with a different CPU, core count or memory, so the changes might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

⚡ 3 improved benchmarks
❌ 2 (👁 1) regressed benchmarks
✅ 189 untouched benchmarks
⏩ 3 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Memory mem client loader-data-retention (vue) 104 KB 107.9 KB -3.66%
⚡ Memory mem server error-paths redirect (solid) 11.5 KB 11.1 KB +3.51%
👁 Memory mem server error-paths error (vue) 136.8 KB 130.9 KB +4.5%
👁 Memory mem client navigation-churn (react) 85.7 KB 83 KB +3.21%
👁 Memory mem client unique-location-churn (react) 76.9 KB 81.7 KB -5.87%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing compiler-rewrite/yuku (f26bfaa) with main (61d5cdd)

Open in CodSpeed

Footnotes

  1. 3 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. ↩

@Sheraff

Sheraff commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator Author

🤖 Written by Claude (AI) at the maintainer's request, from a brainstorm over this PR's architecture; reviewed by a human. Revised for the final state of the branch.

What this rewrite unlocks.

Before: each transform re-parsed the previous one's output, APIs were matched by name, and removal was guessed.

Now:

  • one analysis per module and environment, shared by every transform;
  • recognition by binding, across re-exports, namespaces and factories;
  • edits on the original source ranges, with exact maps;
  • one placement for every output: route chunks, server-fn handler modules, <Hydrate> chunks and plain erasure. Its rules are closed. They follow names, references and assignments, and never ask what code does.

The stance of this PR. Route splitting, <Hydrate> chunks and erasure are held to "at least as good as main": the same splits and the same runtime behaviour wherever main works, and anything that works where main is broken. Improvements over main were kept out on purpose, so the first group below is the list of things the PR could do and doesn't. Each is one rule change in one place, checked by the differential gates against main that the PR already runs.

Effort: S = days, M = weeks, L = a quarter.

Kept out of this PR, cheap to add now

  1. Split an option whose value the route file exports → today it stays in the route module with a warning, as on main, so a component one route exports and another imports is in the entry chunk → a forwarding module for the export, and route-to-route imports pointed at it → M (HMR identity, webpack/Rspack) → less initial JS; see the headroom comment.
  2. One instance instead of copies in <Hydrate> chunks → a chunk copies the module-level declarations its children reach, as main's does, so a context, a store or a reassigned let exists twice (ten shapes in KNOWN-BUGS) → import what the file's other code also names, copy only the rest → M. A throwaway prototype of that rule for every output was about 60 lines; it moved bytes in 79 of 12,337 corpus route files (78 with more eager bytes), so it needs its own decisions → those ten bugs go.
  3. Import instead of copy in route chunks → a chunk that reads a class, enum or namespace copies it, so its body runs twice, as on main → the shared module already gives one instance for main's shared names; widen what counts → S–M.
  4. Loader objects the route file doesn't write → loader: importedObject splits whole and breaks at runtime when the loader is split, as on main → read the import's summary (Start already has cross-module summaries) → S.
  5. A server fn written in place as the loader → compiled, but not split → let the router planner take Start's hoisted binding as the value → S.
  6. Fully lazy route CSS → route CSS stays in the route module, as on main (20 pins); the compiler can list each route's style imports, router-core needs a per-route asset loader → M.
  7. More split keys: head and scripts are awaited after loaders, like a split loader → a new split key is a declared root → S each. validateSearch and params schemas run synchronously during matching, so splitting them needs async validation in router-core → M–L.

Top picks beyond main

  1. More lint-like diagnostics with exact positions: e.g. "loader imports a component-only module", "this server fn handler writes module state the client also reads" → the compiler knows bindings, which output a reference lands in, and the original line and column. Positioned errors and warnings already ship on every bundler (builder escapes, refused server-fn positions, unreadable route options, a function using its own this) → S–M per rule → broken splits and leaks caught at build time, clickable in the Vite overlay and in Rspack/webpack output.
  2. Compile-time route manifest + preload hints: route → split modules and server-fn ids come from compile results; only file names come from the bundle (today the manifest scans client chunks for route files) → M → exact Link preloads, per-route modulepreload and early hints, fewer waterfalls.
  3. createServerFn({ serializable: true }): a server fn opted into being sent to the client as data gets a real client builder and is always HTTP-callable → the builder chain is a recognised value, and the set of HTTP-callable server fns is already collected → S–M → client middleware runs for serialised server fns, instead of a production rejection.
    const getUser = createServerFn({ serializable: true })
      .middleware([authClientMiddleware])
      .handler(() => …)
    // returned from a loader: callable on the client, client middleware runs
  4. User planner API: a Babel-free replacement for the removed compiler hooks: read the module analysis, emit edits, outputs and diagnostics → the built-in transforms already use this contract, and Start already consumes the router's planners through @tanstack/router-plugin/planners. The internal contract hands planners Yuku nodes and has no semver, so a public version needs a facts-only view or a promise about Yuku's AST → M (mostly the stability promise) → i18n extraction, custom rules, RSC integrations without forking.
  5. Lazy route modules (router-core): path-only route shells that import() the file on first match → the generator has a pure route model, and unvisited files stay cold → L (match-time loading, types, manifest, HMR) → the largest dev-startup win left (see the headroom comment).
  6. Automatic server/client boundary inference: treat modules reachable only from server handlers as server-only without a marker; split mixed modules per env → markers are per-file facts and erasure already decides per output. But placement deliberately doesn't reason about what code does, and only import protection has an effect model, so this needs a semantics design first → L → fewer .server.ts files and leaks.

Also enabled

Compiler APIs

  • ssr: false route code pruned from server output → erasure decides per output; the route model needs each file's ssr option and its inheritance → M → no server evaluation of browser-only modules.
  • User-defined env markers (e.g. edge-only fns) → recognisers are pluggable; marker kinds and envs are server/client today → M → compile-time pruning for custom runtimes.
  • startInstance.createServerFn(…) → startInstance.createMiddleware(…) is recognised already; the other is one recogniser entry → S.

Diagnostics / devtools

  • "Why is this in my client bundle?" and "why didn't this split?": the chain from an output's root to a declaration, as JSON → placement holds it; the reasons an option stays unsplit are already warnings → S–M.
  • A devtools panel showing per-route compile facts (split groups, server-fn ids, import-protection verdicts) → M.
  • Compile-time Link checks (unknown routes, missing params) for JS projects and dynamic strings → the route model exists, and Link is recognisable by binding → M.

Routing

  • Cross-file shared-module placement (one lazy module for helpers several routes need) → M → fewer duplicated bytes.

RSC

  • 'use client' reference stubs and 'use server' as planners in the same pass → the per-env directive policy exists → M → one model for server fns and RSC.

Bundlers

  • esbuild autoCodeSplitting (refused today, as on main; route generation with esbuild now works) → the core is host-agnostic and derived-module ids work on every bundler → M (side-effects handling).
  • Bun or Farm hosts → the router's Vite and webpack hosts are ~400 lines each over the same core and behaviour suite (Start's are larger) → M each.
  • A tsr compile CLI over a directory → S → debugging, codemods.

Maintenance: React, Solid and Vue share every planner, so features reach all three at once.

Since the first version of this comment

  • Done in the PR: positioned diagnostics on every bundler; options written as methods split; an object-form loader's handler splits; one instance per server fn and its module state; server fns in any position evaluated once at load; an exported server fn the client never uses leaves the client bundle; <Hydrate> through the app's own re-exports; route generation in the esbuild plugin.
  • Dropped: placement by purity. The earlier branch placed code by what it does (effects, timing) and got several shapes right that main gets wrong; that was replaced by main's rules to guarantee main's behaviour. Items 1–3 of the first group are the route back to those wins, one rule at a time.

Sheraff and others added 30 commits November 26, 2026 05:58
… with its record as the sink

Rsbuild's loader hands its modules to `StartCompilerSession.transform`
like Vite's hooks: the main pass, the late pass (D-30's admission: a
Start-declaring package's module, or the main pass's rule) and the asset
pass, with a child compiler's module as its own instance. Its `record()`
is the session's sink: every answer writes the module's `buildInfo` parts
(current or not), and only a current one commits. Which modules hold a
record is the session's committed-id set (Rsbuild's `recorded` is gone),
kept by the sink and the restore scan; a child's passthrough no longer
retires the compiler's import protection record. A module Rspack types as
an asset (`asset/source`) is judged as an asset and never compiled
(S5-10); the late pass's code the compiler cannot parse fails the client
build, as on Vite.

Deleted: Rsbuild's `ModuleOutcome` (its record takes the session's
outcome and `ModuleRecord`), `recorded`, `notCompiled`, `protect`,
`diagnose`, `NOT_COMPILED`; the session's `settle`, `afterCompile`,
`assetOutput` and the public `late` input; import protection's
`afterCompile` and `buildInfo(id, out)` (now `buildInfoOf(record)`). Import
protection's edge states leave `served` for a map of their own
(`edgeStates`): `served` holds only the modules that are their own
violation.

Rows: `start-build-late-pass.test.ts` "rsbuild build, an MDX module the
compiler cannot parse" and "rsbuild build, an MDX module imported as its
text" (S5-10), both red before.

Settlement design rev 4, step 4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The Rsbuild host keeps its own index of which modules' `buildInfo` holds
  parts (`recorded`, by resource and instance, as long-lived as the
  compilers' modules, restored from `buildInfo` with a child's instance on
  a cache restart); `record()` reads only that. The session's commit alone
  writes the committed-id set, for current answers only: `keepsSet` and the
  session's `hasCommitted`/`noteCommitted`/`dropCommitted` are gone. Two
  modules of one id (`role.ts`, `role.ts?url`) and a restored child module
  clear their own records again; a restored child no longer joins
  `fnModules`.
- One sink for a module and an asset: a failed asset records its located
  errors, so it fails as import protection's report, not as a loader crash.
- `transformAsset` decides on the outcome (a non-denied asset commits
  nothing and enters no set) and calls the sink without import protection
  too.
- The bundler's module type (`ScriptRequest.typeOf`, asked of an admitted
  module): a type that is no script (`json`) is the host's, left as it is.
- `transform` takes the host's identity; `recordKey` runs after the early
  returns with the id; `StartCompilerSession.report()`, `fail()`'s
  `overtaken` and `served()`'s `key` deleted; stale comments and
  COMPILER_ARCHITECTURE.md updated.

Rows: `asset-dev-error-rsbuild.test.ts` (red before: Rspack's
"Module build failed" wrapper), `start-build-late-pass.test.ts` "rsbuild
build, a module the app types as JSON" (red before: the late pass parsed
the JSON as JSX).

Settlement design rev 4, step 4 (reviews: Fable, Astra, Gemini).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…differ

The loader's `typeOf` read `ctx._module.type` for every admitted module:
2,091 binding calls per build of compiler-perf react-start, the +1 % of
the Rsbuild build. It is asked now only of a late-pass module or one whose
request carries an app query (`?raw`), never of a derived output
(`?tsr-split`): 0 reads in that app, `_module` gets back to base's 3,777;
`buildInfo` gets, sets and deletes were already base's (the write is gated
by `recorded`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`new URL('./sample.js', import.meta.url)` makes the file an
`asset/resource` through Rspack's own `dependency: 'url'` rule, with no app
rule; since the loader reads the module type only for the late pass and
app queries, Start's main loader compiled it and the emitted asset was
Start's client output. Start's main and late loader rules now carry
`dependency: { not: 'url' }` (child compilers take the same rules), and
the asset pass, whose `new URL` rule no longer excludes scripts, judges a
script Rspack types as an asset (one type read, for a script id there)
instead of leaving it to a loader that no longer sees it.

Rows: `start-build-late-pass.test.ts` "rsbuild build, a script new URL()
makes an asset" (red on 2a5ba1a: the client's isomorphic fn);
`asset-query-scope.test.ts` "a denied script, new URL" (build and dev:
guards the asset pass's verdict, which the rule condition alone dropped).
KNOWN-BUGS: a script an app rule types as an asset by its path alone is
compiled, as before step 4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…led, as on base

Reverts 9f86d4a's loader rules (`dependency: { not: 'url' }` on the
main and late rules, scripts in the asset pass's `new URL` rule) and the
asset pass's type read: each fix to the `new URL` path opened another
shape (a JS-typed `new URL` module not compiled; a script both imported
and loaded by `new URL` losing its violations; a denied JS-typed one
unreported), for a case that behaves as base f184a99. The loader is
2a5ba1a's again.

KNOWN-BUGS: a script that becomes an asset with no query (`new URL()`
through Rspack's default rule, a by-path `asset/source` rule) is compiled
when its text names a Start API; a query keeps the text. The loader
comment says the same. The exact-text row is dropped; the rows "a denied
script, new URL" (build, dev) stay, green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…or slow agents

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every type position in code that stays (Yuku's `inTypePosition`) seeds the
removal closure as erased text, whatever holds it: an annotation or a cast
of running code, a type argument, an overload signature, an abstract or
`declare` member. A value only types name leaves with its initializer, in
every environment (user decision, 2026-11-25). Two exceptions, the
decided ones: a named erased declaration (an alias, an interface, a
`declare`) is read when it is named or exported (D1, T5-T8;
`Declarations.inNamedDeclaration`, and `exportedErased` for main's
`stripTypeExports`: a local of an export, a member of an exported
namespace, dotted or nested), and an import is the host's
(`verbatimModuleSyntax`). Decorator metadata stays a read by value
(`metadataNames`). The pass runs where a type position names one of the
module's values (`Tier1.typesNameValues`, from the Tier 1 reference loop).

Gone: `Declaration.signature`, `Unit.typeExport` and its unit arms, and
closure's type-export parts, which this rule replaces. `export type * as
Ns` exports nothing; hmr's type-only import check reads `stripped`.

Rows: the follow-up's removal, import-protection and ambient-export rows
come over; the ones the decision changes are replaced by rows of the new
behaviour (a local value only an overload signature names, a running
function's annotation, erasure's local-type and class-as-type rows, the
typeof type query, the route module's declaration only a type names); the
ambient forms nothing names and an exported `declare class`'s heritage go
back to the landed outcome (KNOWN-BUGS). New: decorator metadata on Vite
and Rsbuild. Changeset and guide sentence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Type export syntax and exported erased declarations are removed text in
  every module again (no longer behind `typesNameValues`): an import only an
  exported type names leaves, as on a0f6fcc.
- An import that only types of code that stays name is the host's through
  any chain of aliases: `follow` reads a declaration for its imports only
  from removed text, so the pass is exact where no type names a value.
- A classic JSX pragma's factories (`@jsx h`, `@jsxFrag`) are value reads
  where JSX is, from the header's pragma pass.
- Decorator metadata reads the constructor a keyword type serializes to
  (`string`: the module's `String`), as Oxc and SWC emit it.
- The self-check takes no free read inside ambient text (the heritage of a
  `declare class`).
- Linear: removed and ambient ranges are a sorted cover, and the scopes
  around a text come from a scope tree.
- A merged `declare const x` + `type x` is ambient text (T7).
- Docs: a class only types name is removed with its decorators and static
  blocks (user decision, accepted as built).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…flags allow an erased one

`exportedErased` now runs in every module: a binding without the ambient,
type, namespace or import flags (and no `declare` beside its definition)
has no erased declaration, so its rows are not built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The exported erased declarations are looked for only in a module with a
  type unit of its own or a namespace block: elsewhere there is none.
- The scope index is built from one numeric sort into typed arrays (still
  on the closure's first read of a nested text).
- The HMR refresh check tests that every unit is a type before it looks
  for a stripped one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the type rule

- Decorator metadata: a class that emits it reads, where it is defined, the
  module's own binding of every global metadata can name (TypeScript's
  serializer's set: String, Number, Boolean, BigInt, Symbol, Object,
  Function, Array, Promise), instead of mapping type shapes case by case.
  Class type references keep their promotion.
- Classic JSX by config: a `React` of the module's own is read where JSX is
  (an imported one is the host's).
- A `declare` stays as written: its text (and a cluster of type units)
  reaches an import only when removed text leads to it (`REMOVED` cause), as
  on a0f6fcc and main, so an import a staying type names through a
  `declare` is the host's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… own React to main's behaviour

The user's decision (A″, narrowed): "we need to be reasonable, we will never
cover the entire syntax". In a module with decorators (what their metadata
reads is the emitter's) or a non-import `React` binding in any scope (a
classic JSX runtime the bundler may be set to calls it), `typesNameValues`
is false: types keep what they name there, as on main, and what only server
code reads still leaves.

- Deleted: the metadata globals set and its reads, the classic-by-config
  `React` path, and their rows. Kept: `metadataNames` and its lookup (it
  now also says whether the class has a decorator), the `@jsx` pragma
  factories (read from the header's pragma comments), the ungated fixes.
- Rows for the comparison with main: a shadowing `Number` and a `String`
  only server code reads leave; a function-local `React` only a type names
  stays; a class a decorated `Two | never` names stays.
- KNOWN-BUGS: decorated and own-`React` modules keep what types name; a
  config factory other than `React` with no pragma can leave.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…act members close the gate

- The `@jsx`/`@jsxFrag` factory is the pragma's whole identifier as
  JavaScript defines one, Unicode included (`hΩ` was cut to `h`).
- A decorator on an abstract property, accessor or method is a decorator:
  `metadataNames` reads those members, so the gate closes and SWC's
  metadata for them keeps its class, as on main.
- `metadataNames`' comment no longer claims what unions serialize to.
- KNOWN-BUGS: a local alias of an imported `React` only types name leaves
  under a classic runtime set by config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the generation

`stable(snapshot)` is the one check of a plan's dependencies for an
attempt before publication, a plan hit and `restorePlans`: it asks what
may have moved since the snapshot's versions (resolutions once the file
set moved, raw facts once their version did), and accepts synchronously
in the caller's turn (`accept`): both versions unmoved since the check
began, the route-registry digests read again, and the entry judged still
the one. A version that moved during the check makes it check again: the
facts version too (p1), not only the file set. A failed hit is counted
(`staleHits` / `lazyHits`) from that one check, not a second validation
(C6-13).

`PlanCache.delete` moves the key's generation: every eviction (a failed
hit, an invalidation, a registry change, an own-file event of another
text) without a bump at each caller. An own-file event no longer sets the
key's latest text from the file's raw text (C6-03): it evicts a plan of
another text, and moves the generation when the latest request's text
differs, so a compile of a plugin-transformed text attempts again and
publishes. A latest untouched settlement retires a restored plan's
dependencies too (C6-09).

Rows (`router-utils/tests/freshness.test.ts`): the four step-0 pins (C6-01
hit and restore, C6-03, the registry digest during a hit) are green; new
"a change of what the restored plan read stales nothing" (C6-09, red
before). The p1 rows stay green with the `asked` bump off; the
comment-only pin stays for step 6b.

Settlement design rev 4, step 6a.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n rule, one answer per fact

- A snapshot check acts on its verdict in the turn it is reached
  (`checkSnapshot`'s judge: `still`, `accept`, `refuse`): a failed hit's
  eviction can no longer remove a newer text's plan published meanwhile.
  A plan hit takes one round: one that overlapped an event compiles
  (its attempt's `stable` is the check), so a storm no longer loops hit
  checks.
- Evicting a plan of the key's latest text moves the generation; a plan
  of an older text or a restored one has no current answer, and an
  event of the latest request's text moves nothing (no second attempt,
  an open answer of that text stays current).
- An event of another text than the latest request's, or of one the
  compiler cannot compare (a module compiled in place), moves the
  generation and stales the file until a request settles the event's
  text; only a removal clears the latest text (`PlanCache.removed`).
- An attempt reads one answer of each fact (resolution, raw facts,
  target facts, marker), however many reads ask it: two reads of a
  dependency saved and saved back no longer reach the plan as two texts.
- A virtual module's miss is kept in the raw-facts cache, so
  `expireVirtual` and its change event find it.

Rows in `freshness.test.ts` for each (red on def30553f5 or, for the
one-answer row, with the `asked` restart off), plus the C6-09 control.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…stable again; virtual marker misses

- A plan hit checks with `stable` again (the round that refuses in its
  own turn), not one round falling to a compile: a compile of the hit's
  text replaced its plan with no eviction, so an open answer of the old
  plan stayed current and the file was not stale. `checkSnapshot` is
  `stable`'s private round.
- `RawFactsCache.marker` keeps a virtual module's miss (a markerless
  entry), as `get` does: `expireVirtual` and the module's change event
  find it.
- `supersede`'s `kept`: the restored-plan test was dead (a published and a
  restored plan are never both held).
- KNOWN-BUGS: a restore checked while a request runs and ends, two
  persisted snapshots of one key, and `TSR_COMPILER_NO_CACHE=plans`
  replacing a same-text plan without eviction.

Rows (`freshness.test.ts`): the hit whose resolution moves during its
check (open answer, stale set; a request joining its compile), the
virtual marker miss (expiry; change event in flight), a file removed and
created again with the same bytes, one specifier from two importers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…evidence; config-mid-check rows dropped

- A virtual module's load that throws is read as missing for that read
  only: no raw-facts entry is kept (`get`, `marker`), so it is read again
  at the next ask after a facts move, as before step 6a. Only the host's
  clean `null` is a miss the cache keeps. Start's Vite host passes the
  rejection through (no `.catch(() => null)`). Without it, a server-only
  virtual module whose first load failed stayed markerless for the dev
  session: its importer's client edge was never denied.
- A config change during a compile or a check is not a case the core
  handles: the C6-01 rows (a tsconfig edit while a hit, an attempt or a
  restore waits on the resolver) are deleted. "A plan hit whose
  resolution moves during its check" now moves the resolution by a file
  creation the plan's rows do not watch (an alias target elsewhere).
- KNOWN-BUGS: a text requested again while its first compile runs (A, B,
  A) is compiled twice at one generation (on a37f460 too).

Row: "a load that threw is read again: the next request after a save
sees the marker" (the compile rejected on 702aea2eae, whose hosts caught
the throw into the kept miss).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A virtual module's load that threw now keeps its raw-facts entry with no
facts instead of none: every read still loads it again (it is never
served as a fact), and `expireVirtual` and the module's change event find
it, as they find any other virtual entry. Before, a watch rebuild after a
thrown load that then recovered served the importer's plan with no
marker.

Rows: "a watch rebuild after a load that threw and then recovers sees the
marker" (red on 87da2c9a91); the C6-01 attempt and restore rows written
again with the file-creation trigger ("a compile whose resolution moves
during its check answers the new target", "a restored plan whose
resolution moves during its check is reported stale"), the only rows
reaching a refused attempt and a refused restore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dependents index holds only the published (and restored) plans' rows;
a compile in flight has none. Its snapshot check (`stable`) asks again
what an event moved (the file set, the raw facts) and refuses or accepts
in its own turn, so nothing restarts it from outside.

Deleted: `DependentEntry.asked`, `DependentsIndex.ask`, `drop(…,
'asked')` and the two-fact rows (a row is a key now), the ledger's
incremental rows (`indexPath`, `indexKeys`, `publish`: `PlanCache.set`
publishes a plan's rows from its dependencies, as `restore` does), the
`revalidate` bump and `PlanCache.bump`.

What the `asked` rows also told:
- An event that reads a file empty waited for its text when a compile in
  flight had read it. Now the reader waits: an empty read of a file whose
  last event read it empty is no evidence (`RawFactsCache.maySave`, the
  in-place-save wait `readSaved` already had for a file that held a
  module), so any compile reading it after the event, superseded or not,
  reads the saved text. A code file's only (an asset reads as '' and never
  waits), and once per event (an event that waited in vain, `emptyAt`,
  confirms the file is empty).
- `RawFactsCache.marker` keeps its entry with the target-facts knob off,
  as `get` does, so a virtual module's change event finds it.

Rows (`freshness.test.ts`): "a comment-only edit: the compile is not
attempted again" un-pinned (KNOWN-BUGS entry removed); new "a load that
threw, announced during the importer's compile, reaches the importer",
"a virtual module's exports read when its load threw" (the `get` half),
and "a dependency truncated and written while a compile that resolved it
runs" (Astra's watcher sequences: the compile's own text, and an older
text superseded meanwhile), and "an empty read after a file's event" (an
asset schedules no wait; an empty code file is read once per event).

Settlement design rev 4, step 6b.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hat were measured

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… record follows the output on disk; one resolverManifest

The client-build record has one setter (`ClientBuilds.setClientBuild`),
called in one of Start's `enforce: 'pre'` plugins: none at a written
build's `renderStart` (`order: 'pre'`: Vite empties the output directory
in that phase), the written output at `writeBundle` (`order: 'pre'`, from
the bundle `writeBundle` gets: after every plugin's `generateBundle`), an
in-memory build's (`!isWrite && build.write === false`, never an RSC
run's plugin-rsc scans) at `generateBundle` (`order: 'post'`). Every call
ends in `followClientBuild` (the sentinel). Production builds only.

The record holds the referenced functions' descriptors and the callable
ids; the SSR provider's resolver lists the record's descriptors (the
server environment's own declaration where it has one), not the live
registry joined with ids. RSC: the provider list follows the provider's
output the same way (withdrawn at its `renderStart`, committed at its
`writeBundle` from what its resolver listed); `callableNotProvided` reads
the record's descriptors.

One `resolverManifest(entries, shape)` decides what a resolver lists and
how it gates, for Vite and Rsbuild (S1-14, S5-07): `client-gated`,
`provider-first`, `provider-gated`, `dev`.

Deleted: `publishClientBuild` and its early write at `generateBundle`,
`NOTHING_CALLABLE` and the bundled dev client's record (S4-08), Vite's
half of `session.published` (the session's `clientCallable` is pure; Rsbuild's
`publishClientOutput` keeps its publication: S3-20), `providerListed` set in
the resolver's `load` (S4-27), `productionResolverModule`,
`providedEntries` and the `clientReferencedOnly` option; KNOWN-BUGS "a client
rebuild whose output fails keeps the previous client build" (fixed).

Rows: un-pinned `start-build-settlement-output` "another plugin's
generateBundle fails" and `start-build-settlement-ids` "S4-02"; new
`start-build-settlement-record.test.ts` (Start's own output-phase failure,
a denied import under `behavior: 'error'`, with recovery; Astra's
stylesheet renamed by a later plugin; `write: false` in watch mode) and
`tests/vite-client-build-record.test.ts` (when the setter runs, the
in-memory build included).

Settlement design rev 4, step 7 (the decided trigger).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es no client file; the provider list from module meta

- With no client-build record the production manifest names no client file (no dev entry); the settlement helper
  checks every client URL the document names.
- A written client build with two entries fails at generateBundle, before anything is written, as before step 7.
- The separate provider's list comes from the resolver module's meta, read when the provider's output is written
  (or generated, for a build that writes nothing): no held value across builds.
- One rule for builds that write nothing (write: false without watch, watch.skipWrite): the in-memory path.
- Dropped the RSC-scan guard and ClientBuilds.rsc; resolverManifest takes two arguments, the dev shape one
  boolean; writtenBuild sits next to the record.
- KNOWN-BUGS: the record's limits, the two measured costs, a deleted server-fn file with a client build failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…te and build.write on has no client build

Vite empties the output directory at renderStart whenever build.write is on, skipWrite included, and such a build
writes nothing: the record (and a separate provider's list) is withdrawn and nothing commits it. One function,
outputOnDisk (written, emptied, unchanged), replaces writtenBuild; only a build that leaves the directory
unchanged (build.write: false) takes the in-memory path. KNOWN-BUGS limit 5 corrected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ctory call

when-does-this-run rule 2 (DECISIONS 2026-11-26): the hoist of an inline
component call (`memo(…)`, `withAuth(Page)`) no longer proves that nothing
the route statement evaluates before it runs code. `onlyInertBefore` and
`isInert` are deleted; `refreshRegisters` stays (what React Refresh
registers, not timing).

One guard: a call is not hoisted past an earlier declarator of its own
declaration (`export const Helper = Page, Route = …({ component:
memo(Helper) })`), where the hoist read `Helper` before its initialisation
(ReferenceError at load, also on bded194).

Rows: the earlier-declarator case loads and renders (unsplit and
`codeSplitGroupings: []`); `memo(…)` after options that call functions
keeps its state across an edit. Deleted: the S2 rows asserting the
refusals (an earlier option's call runs first; `memo` kept inline after a
call). KNOWN-BUGS: the reorder, both directions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, in every module

when-does-this-run rule 1, B (DECISIONS 2026-11-26, "dynamic marker
imports"): a dynamic `import()`/`require()` of `server-only` or
`client-only` never marks its module, so the three-function-type ancestor
check in ModuleAnalysis is deleted. The import-edges planner judges a
marker edge in any module without a static marker, not only in entries,
wherever the module's output keeps the edge. A server fn handler's
import is erased from the client output and is not judged there.

This closes bded194's silent case: a marker imported in a function the
client keeps was neither marked nor reported, and the module shipped. In
the `error` behavior the build now fails at the marker import, as on main.
Under `mock`, only that import is mocked and the rest of the module ships,
as on main with Vite. KNOWN-BUGS, SPEC J6.1 and the import-protection
guide say so, with the advice that a static marker import protects the
whole file. markerConflict reads static markers only, the only ones that
mark.

Rows (build-markers, Vite and Rsbuild): a dynamic marker at the top level,
in a function the client keeps, a class field, a static block, a computed
class key or a TypeScript namespace fails the build at the marker import;
one in a server fn handler leaves the module to the client; in mock mode
the import is mocked alone and reported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mport

User decision 11-26, replacing B: dynamic marker imports are not
supported when they add any complexity. A marker is a static import or
re-export; a dynamic `import()` or `require()` of one is an ordinary
import: it marks nothing and gets no marker judgement of its own.

Deleted from 7a7adca: the marker-edge judgement widened to modules
without a static marker (`edges.ts` is bded194's again but for
`markerConflict`, which reads static markers only, the only ones that
mark); its KNOWN-BUGS mock limit and guide paragraph; the dynamic-marker
rows of build-markers (the positions, the handler body, the mock row).
The ModuleAnalysis marker branch of the dynamic-edge loop stays deleted.
Also deleted: the builder-shapes refusal "a marker as a dynamic import",
which asserted that a top-level dynamic marker marks its module.

Guide, SPEC J6.1 and a KNOWN-BUGS accepted limit say it: a marker is a
static import; a dynamic one is an ordinary import and is not checked (a
client entry's own marker import is still judged at its import whatever
its form, as on bded194).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ildren in place with one warning

Children the split would hand a copy of a binding instead of the binding are not extracted: children assigning a
captured local, on React a function of the children reading a local the component reassigns (no proof of when the
writes run), a capture declared after the boundary (D-27), a Solid ref in a nested boundary naming a local outside
both, children or code only they use assigning a module binding (the core's shared-writer fallback). The boundary
renders in place as with split={false}, keeps its id in every env (the server is unchanged, D-25), and the client
compile warns once (`hydrate-not-split`). Text-only children are never extracted, in any spelling (D-26).

Deleted: writesComplete, WRITE_CONTAINERS, moduleWriteMessage and the refusals hydrate-capture-reassigned,
hydrate-capture-write, hydrate-nested-ref, hydrate-module-write, with their rows; SPEC J5.5 rewritten; docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…27 rule and the two-chunk module write

- D-27 is one rule: a capture whose runtime declaration (the declaration table's value rows, by the symbol's
  binding) does not end before the boundary starts keeps the children in place, a hoisted function excepted. Covers
  a type of the same name before a later const, a local holding the boundary in its own initialiser (const, object,
  array pattern, var) and a Solid directive.
- Placement: an output assigning its copy of a binding another output holds unwritten falls back whatever the
  binding's home (a module let only two Hydrate chunks use, one assigning it, was two silent copies); the removed
  home still means nothing to import.
- Wording: main splits a capture whose declaration ends after the boundary and may read it early (not "throws").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ary is no longer a limit (D-27 keeps it in place)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… not another case's on the shared channel

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant