Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: truePre-merge checks:
|
🦋 Changeset detectedLatest commit: 991b790 The changes in this PR will be included in the next version bump. This PR includes changesets to release 25 packages
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 |
|
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 your CI Pipeline Execution ↗ for commit 991b790
💡 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 |
🚀 Changeset Version Preview15 package(s) bumped directly, 10 bumped as dependents. 🟨 Minor bumps
🟩 Patch bumps
|
Bundle Size Benchmarks
The following scenarios have bundle-size changes compared with the baseline:
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. |
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
¹ 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 HMR against
|
More templates
@tanstack/arktype-adapter
@tanstack/eslint-plugin-router
@tanstack/eslint-plugin-start
@tanstack/history
@tanstack/react-router
@tanstack/react-router-devtools
@tanstack/react-router-ssr-query
@tanstack/react-start
@tanstack/react-start-client
@tanstack/react-start-rsc
@tanstack/react-start-server
@tanstack/router-cli
@tanstack/router-core
@tanstack/router-devtools
@tanstack/router-devtools-core
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-ssr-query-core
@tanstack/router-utils
@tanstack/router-vite-plugin
@tanstack/solid-router
@tanstack/solid-router-devtools
@tanstack/solid-router-ssr-query
@tanstack/solid-start
@tanstack/solid-start-client
@tanstack/solid-start-server
@tanstack/start-client-core
@tanstack/start-fn-stubs
@tanstack/start-plugin-core
@tanstack/start-server-core
@tanstack/start-static-server-functions
@tanstack/start-storage-context
@tanstack/valibot-adapter
@tanstack/virtual-file-routes
@tanstack/vue-router
@tanstack/vue-router-devtools
@tanstack/vue-router-ssr-query
@tanstack/vue-start
@tanstack/vue-start-client
@tanstack/vue-start-server
@tanstack/zod-adapter
commit: |
Merging this PR will improve performance by 2.02%2 warnings
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
What this rewrite unlocks. Before: each transform re-parsed the previous one's output, APIs were matched by name, and removal was guessed. Now:
The stance of this PR. Route splitting, Effort: S = days, M = weeks, L = a quarter. Kept out of this PR, cheap to add now
Top picks beyond
|
… cache reports its kept modules' warnings A module Rspack restores from performance.buildCache is not compiled, so its loader warnings were never reported: a warm build of a package that does not declare Start shipped the app's handler with no warning (decision 11 A rests on decision 6's warning). The warnings each compile records in the module's buildInfo (located diagnostics) survive the cache; a production compilation now hands those of the modules it kept to the after-seal report development already uses. Source: Fable's review of the node_modules policy implementation, finding 2. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Vite dev; a client-only package module on the server Source: Fable's review of the node_modules policy implementation, finding 8. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pile's; the package warning decided from the build's modules Rsbuild's persistent cache restores a module without compiling it. The round-1 replay read the warnings a compile recorded, but records were written only when a compile had something to say and never cleared, so a warning fixed in a watch rebuild came back from the cache; and the "does not declare Start" warning lived only on the module that won it this run, so a warm build could lose it, print it twice, or keep it after the manifest changed. - Each compile resets its module's records (what it reported, what it found before the once-per-run rule, and whether it recognised a Start use in a package), early exits included. A production build on a persistent cache replays a kept module's found warnings through the run's warning ledger, so a module compiled in another environment does not duplicate them. The replay is tapped only with a persistent cache. - On Rsbuild the package warning is no longer reported by the compile: a seal pass decides it once per package instance and run, from the compilation's modules compiled or restored with a recorded use, against the package's current manifest, through the ledger (dev hands it over to the next compilation like import protection's reports). - router-utils: a diagnostic sink may take every warning a compile found, before the ledger (found). Source: round-2 re-checks of the node_modules policy implementation (Fable R1-R3, R5; Gemini 1-3; Astra 1). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y path the exemption matcher takes A pattern the id filter cannot say faithfully now lets every dependency script through, as a RegExp pattern already did: a whole-pattern negation (prefixed with the root it lost its meaning; tested on the absolute id it missed the in-app barrel), and one picomatch refuses. An empty pattern matches no path and no longer throws. Each glob also gets its path as an escaped literal: the matcher takes a path equal to the pattern before the glob, which mattered for paths with parentheses or brackets. Fable's differential (71,760 cases): no exempt path left out. Source: round-2 re-checks of the node_modules policy implementation (Astra 2, Gemini 4, Fable R4). Co-Authored-By: Claude Opus 5.5 <[email protected]>
… through for a negation behind ./ or a repeated ./ prefix Picomatch reads './!glob' as a whole-pattern negation and strips every leading './'; the prefilter stripped one and checked '!' first, so the barrel of an exempted package got the mock on Vite. Those prefixes now take the existing fallback (every dependency script reaches the scope). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hs and only live evidence; a warm dev start prints restored warnings - The seal pass and the kept-warning replay read the module's file through resourcePath (Rspack escapes '#' in resource; Windows paths have backslashes), and test node_modules separator-aware: a Start package under a '#' path no longer reads as one that does not declare Start. - packageUses is the one source of package-use evidence: a compile that takes the loader's early exit removes its entry; a restored module's records (package use, found and reported warnings) are noted when the compiler's first finishMake reads the restored modules, before its rebuilds, so a compile in this process replaces them. - Only modules the compilation holds (an entry, or reached from one) warn: a server fn's handler module that a resolver rebuild left unreachable stays in the compilation and in the cache. - Rsbuild dev on a persistent cache replays the restored modules' warnings in a compiler's first compilation, joined to the hand-over when Rsbuild replaces it before printing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n container exposes as held The seal pass's reachability check read import protection's grounded graph, whose entries exclude a module of no file: a module only a ContainerPlugin exposure imports read as unreachable, so its package warning (cold and warm) and its replayed warnings (warm) were dropped. rspackHolds walks incoming connections through any module, of a file or not, to a connection from no module; an orphaned server-fn handler module still has none. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`DiagnosticSink.warn` is optional: a host that decides which warnings a build reports itself, later, from what `found` gave it (Start's Rsbuild host, at seal) consults no ledger. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the content they were built from Rule 3 of the Rsbuild host (hotspot 3). Start's loader records on the client route tree, the server-function resolver and the Start manifest the digest of the bytes each is built from; at `finishMake` a module is built again only when that differs from what the compiler's virtual file system holds now (`generated-module.ts`, one index per compiler, a compilation read once for a module the index does not know). A compilation without the module says nothing of what it is built from. Replaces the write counters (`rebuiltAtWriteCount`, `manifestWriteCount`, `onlyWhenWritten`), the tree's `version`/`served`/`stale()`/`builtAt`, the resolver's child branch and the "a restored module is rebuilt once" exceptions. A build or a dev server on a primed cache builds none of them again (user decision 1: a restored route tree is an ordinary cached module, so an app transform on it runs when the tree is built, not on an unchanged restore). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…gs each have one writer Rules 1, 2 and 4 of the Rsbuild host (hotspot 3; user decisions 2 to 5). Rule 1, a module's record is what the loader served: one writer (`StartRsbuildCompilerSession.record`) per loader run, at every exit (compiled, served as its mock without server functions, not compiled, failed; the asset and edge passes too). The parts stay separate `buildInfo` fields behind `module-record.ts`; one index says which modules hold a record. Replaces `recordServerFns`, `forgetServerFns`, `recordDiagnostics`, `holdsDiagnostics` and `throwLocated`. Rule 2, the registry is derived at settlement from the modules the compilation holds, by one writer (`serverFnsAtSettlement`, set only by this host: a compile registers nothing). A function needs a real caller: the resolver's own import of a provider is not one. The last closure derives again when a loader ran since. Removing the last import of a server function in dev drops the function and its file, as on main (H2-dev); a module the client gets as its mock declares nothing (H4). Rule 4, warnings are decided at seal from the held modules' records, once per build run and once per printed dev session: in dev a compilation offers, the assignment happens as compilers finish, a print commits. The loader emits none. Deletes the hand-over, the kept-module replay and the handed-over package report; a development-mode `build --watch` rebuild prints a kept module's warning, as a production-mode one does. Rows: dev-server-fn-unimported, watch-marked-edited-clean, client-mock-server-fn, late-rebuilt-server-fn, worker-warnings, dev-package-warning-overlap; decision 6 pins one-instance-builds and worker-route-tree. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ces the page's A page and a worker (a child compiler of the client) import the same package that uses Start without declaring it. A worker plugin that does not hand its child's warnings to the client compilation silenced the package warning in builds and dev servers: the child claimed the key at its seal, before the warning reached any compilation Rsbuild prints. A child's report is now provisional: the child adds the warning on behalf of its owner, and it counts only when the owner's compiler finishes holding it (matched by how the warning reads back from Rspack and its module); otherwise the warning is the owner's to report, or another compilation's that holds the module. Builds take the same path as dev servers (a compilation offers at seal, a compiler's `done` assigns), so a child compilation's warning cannot be printed twice across compilers either; a build reports what its finished compilers carry, a dev server what Rsbuild printed. `claimWarning` and `carryWarning` are gone. Rows: worker-warnings, a shared package with and without forwarding, in a build and a dev server (red on the prototype without forwarding). Source: review-hotspot3-merged-2-astra.md, required change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r function whose caller an edit removed Two rows for what rule 2 of the Rsbuild host (a function needs a real caller) fixes in a watch build with RSC: a server function whose only caller (another one's handler) an edit turned into a plain function, and one whose last client call an edit removed. The rebuild has it in no server output, as a cold build of the edited source. Both red on the integration head (dad2f5a). The accepted limit of KNOWN-BUGS that described it goes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and a changeset COMPILER_ARCHITECTURE.md states the four rules of the Rsbuild host (a module's record is what the loader served; the registry is derived at settlement by one writer from real callers; a generated module is as current as the content it was built from; warnings are decided at seal and count once reported) and drops the hook chronology they replace. KNOWN-BUGS: web-infra-dev/rspack#16839 (a build on a cache a watch session wrote can fail to link), a foreign `pre` loader on a generated module, and the untested second RSC dev server of one instance. The oracle README no longer names the deleted hand-over unit test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…very mode The server compiler's manifest check (`tapManifestRebuild`, rule 3: the module is built again when it was built from another manifest than the one written last) ran in dev servers only; RSC builds already ran it in every mode. Without RSC it now does too, for one rule everywhere. A second `build()` of one Rsbuild instance with the persistent cache, whose restored manifest module named the first build's client files (upstream: web-infra-dev/rspack#16785, fixed by #16820, unreleased), now serves its own; an ordinary build, whose module is current, builds nothing more. Row: one-instance-builds, with the persistent cache (red before). The KNOWN-BUGS entry goes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s seal and once in every report Rule 4 of the Rsbuild host, revised after the implementation reviews (design-hotspot3-merged.md "Rule 4, revised"): 1. A child compilation's warnings go onto its owner: a worker's warnings are added to the environment compiler's current compilation, so nothing depends on what a worker plugin does with a child's own warnings. A child's modules the persistent cache restored are indexed as the compiler's own are. 2. Each compilation adds its warnings at its seal (`warn`), unless a current compilation of any compiler carries them: they are there before emit. When a compiler finishes, a warning whose carrier a newer compilation replaced goes to a current compilation that holds it (`finishWarnings`). 3. "Reported" means printed: a dev server records what each `onDevCompileDone` printed, once per dev session. 4. No reset is keyed on a compiler's `watchRun`. A build keeps no reported set: Rsbuild prints the last compilation of every compiler, and one current compilation carries each warning, so each report has each once whichever compilers a rebuild ran. The host's own once-per-run reports (a custom server function id's error or deprecation, a closure that cannot settle) take the same path instead of the session's `WarningLedger` and its reset at the client's `watchRun`. Deleted: `childWarning`, `fromChildren`, `warningSignature` and the read-back match, the `done` flag and the build's commit at `done`, `resetWarnings`. Rows (red on a6ba68f, 18): worker-warnings, worker-warnings-dev, build-warnings-before-emit, watch-warnings. Sources: review-hotspot3-impl-{astra,fable,gemini}.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n every compilation A child compilation's modules the persistent cache restored were indexed only while the compiler had not compiled yet. A dev server's `retain` forgets the index of modules whose files its compilation does not depend on, which a child's are: with `performance.buildCache`, a module only a worker imports printed none of its warnings at a cold start (the first client compilation is replaced before the report). And a worker first requested on a watch rebuild of a warm cache restored its modules after the compiler's first compilation: no warning either. The index pass now runs at every child seal when the compiler persists modules. Source: review-hotspot3-impl-2-fable.md change 1 (Fable's child-index.patch), review-hotspot3-impl-2-astra.md finding 1. Rows (both red before): worker-warnings-dev, on the persistent cache (cold 1, warm 1, 0 after a save); worker-warnings, a worker first requested in a watch rebuild of a primed cache (each warning once in every report with the worker, in both sessions). KNOWN-BUGS, re-check 2: Rsbuild dev prints an unchanged compilation's warnings again with each report (its convention: Rspack's own warnings do the same); the deprecated custom-id warning has no once-per-report guarantee (the allocator returns it once); a dependency's manifest edited during a watch keeps its classification (restart the watch); entry wording (a child awaited in `processAssets` is on the owner at `afterSeal`; the after-report case applies to watch builds). The architecture doc's deprecation sentence and the `FoundWarning` comment are corrected. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he router's own-this check uses it walkMoved reports the this/super/new.target/arguments/await/yield/private names moved code takes from around it, and when its parts run (runs per node, callables by text); contextOwner climbs to the construct providing a use. A parameter's decorator has the code around its class: a loader whose nested class decorates a parameter with the loader's `this` now stays unsplit with split-this (it split and read another `this`). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…around it by the language's scoping Start's hoist asks walkMoved and contextOwner instead of its three walks (enclosingCallCode, privateNameOutside, the chain's function ranges): `this` in a nested class's computed key or a JSX member tag is the class's (refused, it built and read undefined); a private name a nested class does not declare is refused at the name; a member or key named `arguments` and `typeof this` are no uses (they were refused); a function called in place reads at load (refused before initialisation, it built and threw). capturesOf returns references. The reassigned-handler warning sees through a cast. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…walk; free `arguments` is refused
validate() asks walkMoved: every use the children take from the
component crosses (`<this.Body />`, `this` in a nested class's computed
key or a parameter decorator now refused; `typeof this` is no use), the
hook rule reads runs === 'now' (a hook in a class's computed key is seen),
and an instance field's initialiser is a callable for the reassigned
capture (`class { v = count }` refused like `() => count`). Captures come
from capturesOf.
Decision 2: `arguments` of the enclosing function is refused at the read
(hydrate-arguments; the message names `const args = arguments` and
split={false}); the prop, its shared symbols and the read rewrite go with
SPEC J5.2's rewrite rows and the two KNOWN-BUGS pins.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hen its writes are complete before the boundary Decision 3a: a React capture read in a function of the children no longer refuses when every write the client keeps is an ordinary statement of the code declaring it (in its blocks, if, switch or try), ends before the boundary, and the boundary is in that code too, in no loop the variable outlives (the conditional `let` of a wrapped real component). A write in a function or class (async, generator, instance field, called in place or not), after the boundary, holding it, or a boundary in a loop, callback or later-called function still refuses. The mutation model lists a binding's writes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… x where the output keeps it
The analysis takes the session's JSX dialect; under Solid the classified
reference of ref={x} on a reassignable binding holding no callback stays a
read marked `assigns`. Placement's write table and the mutation model count
the mark (the latter only through a liveness filter): split Hydrate
children naming a module let by ref, or a helper only they render, are
refused like an explicit write; a component let set by a ref outside the
boundary reaches the children through a getter; a split Solid route
component whose ref names a module let beforeLoad reads stays in the route
module. A callback-holding let, a let only one chunk uses and a ref in
erased code change nothing. Hydrate's getter decision and Start's handler
warning read marks through the env's liveness.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…alk in the core map, a changeset Co-Authored-By: Claude Opus 5.5 <[email protected]>
…completed-assignment exception and Solid refs Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the call The shared walk gave a generator called in place `later` throughout; its parameters run at the call (its body waits for .next()), so a hook in a default parameter in Hydrate children and a read before initialisation in a hoisted chain went unseen. Start's later-ranges skip a decorated node, whose decorators run when its class is defined (a decorated constructor parameter's range swallowed its decorator), and ownership climbs from the chain. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ses a boundary in a case selector A function's `var` declared again with a value after the boundary gave the captured value later (the mutation model counts only a module's re-declarations): each initialised declarator must now be an ordinary statement before the boundary. A case selector runs before an earlier default branch: a boundary in one refuses. Rows for both, the loop the variable outlives with the write before it, a var and a switch that build, and a hook in a generator's default parameter. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n explicit write of it is kept The callback exemption read the file's explicit writes: a callback let reassigned only in a server-only fn or an isomorphic fn's server half refused the client's split children. The mark now says `callback` or `value`; placement's write table (writeAssigns) and the mutation model count a callback mark only beside an explicit write the output keeps. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ls in the changeset Co-Authored-By: Claude Opus 5.5 <[email protected]>
…signs is a compile error
`let h = …; h = …; createServerFn().handler(h)` shipped server code to the client: the client output keeps
the top-level assignments of `h` with what they read (R154), so in dev the handler's imports loaded and ran
in the page on Vite and Rsbuild (main does the same, silently). The check that warned on the server only now
runs after the hoist check for every site a compile keeps (client, SSR, separate provider, RSC, top-level
await) and refuses the shape, naming the rewrites that work. A Solid `ref={h}` is not an explicit write.
The R182 timing known bug goes with the shape; KNOWN-BUGS lists the positions that still build.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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-eliminationand the Prettier hot path are gone.Guaranteed against
mainmaindoes. Wherevermain's output builds and runs correctly, ours does too, with the same runtime behaviour (the same options split, one instance wheremainhas one, code run once wheremainruns it once) and no more client bytes. Wheremainfails 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..serverfiles 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.Headline numbers (tables under Performance)
mainin 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
mainon 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 thatmainalready handles get their tests here.Parts of this PR have landed on
mainas separate PRs (#8849, #8851, #8852, #8853, #8855, #8856, #8857, #8858, #8860, #8861, #8863, #8866, #8867, #8868, #8869, #8870, #8871, #8876 and thevisible()fix #8653). This branch is merged with them, and their changes aren't described again here.Contents
main· better thanmain· not guaranteedUpgrading 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=…"]The boxes, top to bottom:
start-env → hydrate → rsc-css → router → import-edges. The router plugin alone runs onlyrouter. 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.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.?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.OutputBuilderwrites VLQ maps directly and composes them with input maps.start-env<ClientOnly>start-plugin-core/src/planners/start-env.tshydrate<Hydrate>children extracted into chunksstart-plugin-core/src/planners/hydrate.tsrsc-cssstart-plugin-core/src/planners/rsc-css.tsrouterdeleteNodes, route HMRrouter-plugin/src/planners/router.tsimport-edgesstart-plugin-core/src/planners/edges.tsWhere to start reading: the README above, with
router-utils/tests/helpers.tsopen (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
mainsplits them:main's shared names go into one shared module; chunks importRoute, whatexport const|let|vardeclares and the shared names, and copy the rest.Server functions (lazy handlers, builder escapes), the verifier, caching and hosts
?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 onmain: the user's own chain with the validator dropped and the handler replaced bycreateSsrRpc(id). Calls go through the registry to the one executing instance.start-envtracks 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).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).invalidate(); no Yuku objects are retained. We own the hosts: a native Vite plugin, a Rspack/webpack loader, and Start Rsbuild loaders (withbuildInforeplay 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-perfat0c3f86ecb9againstmain0b6d4f3f6b: 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
main, msAcross 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.
<Hydrate>Memory
eedc638e42).Losses against
mainOne line each; the first three are detailed below.
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-reactdebounces 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 unsplitpendingComponent.hotUpdatere-checks the plans of the edited file's importers;maindoesn't track that dependency. Not worth changing..mapfiles after hashing. Save → DOM is within noise.0c3f86ecb9). It is a self-contained safety net, to be removed a couple of months after the release.0c3f86ecb9), to tell which importers still exist.main("Server bytes" under Other measurements).createClientServerFn(id, chain), which ships once: an annotation on the user's own chain would let bundlers drop the user's calls in it.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.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.0331deb61c, paired): kroma +5.4% [1.3, 8.3] (+93 MB, 5 rounds; onemainoutlier 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 thanmain: its peak depends on when the last mark-compact runs, and nothing was found to change. kroma wasn't re-measured after the Vitenode_modulesfilter 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.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 belowmain: 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 thanmain. 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
0c3f86ecb9loader edits were slower thanmainon 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-reactdebounces 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.undefined. Loader edits are −28.6% [−32.8, −26.9] on react-start Vite medium (64.7 → 46.1 ms;mainread 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;main25.9–33.4 ms), measured with the probe route'spendingComponentremoved. These are A/B runs against the head before the change, 4 paired rounds, 20 edits per kind.pendingComponent. The default groupings don't splitpendingComponent, and the generated apps give one to about 30% of their routes. With itspendingComponent, the react-router probe route reads 34.8 → 34.7 ms (unchanged). Rsbuild loader edits are unchanged (202 ms either way; −34% againstmainat0c3f86ecb9).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.0c3f86ecb9. Before Vite sends the update, ourhotUpdatereads 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.maindoesn't track that dependency. Not worth changing..mapfiles 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 missingsourcesContentfrom the module resource when emitting source maps web-infra-dev/rspack#16348, closed: a map's text must take part in HMR invalidation).0c3f86ecb9a 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-perfat0c3f86ecb9againstmain0b6d4f3f6b. 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,main904–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% againstmain's lower mode. On solid-router large,mainreads 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?urlwasm asset in the harness, so<Hydrate>HMR is not measured.All 11 cells: values, Δ with 95% CIs, HMR p50 in ms
0c3f86ecb9vsmain0b6d4f3f6b, the same run as the table above. Medium = 333 route files (338 on Start). Δ CIs are 95% t intervals of the paired log ratios.Δ% [95% CI] of the same cells:
HMR p50, ms,
main→ this PR, Δ% [95% CI]:<Hydrate>HMR p50 by kind, cells whose CI excludes 0:
<Hydrate>: −10…−65% on Vite, and −68% / −52% on Rsbuild.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,0c3f86ecb9vsmain0b6d4f3f6b, one side at a time, 5 clean pairs.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.0c3f86ecb9ourhotUpdateheld a route edit's update 6 ms longer thanmainand 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 inhotUpdateonly 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,
0c3f86ecb9vsmain0b6d4f3f6b, 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
0c3f86ecb9, the reporter's 1,500-module workload): import protection in dev adds +3 MB of live heap, wheremainadds +322 MB.0c3f86ecb9, 3,000 modules, 600 routes, Nitro): heap when the last environment starts is 65.6 MB, vs 500.0 MB onmain.18ef570edc, KB per cycle, PR vsmain): 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).0331deb61cvsmain0b6d4f3f6b, 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).0331deb61cvsmain0b6d4f3f6b, 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 belowmainsince the Vitenode_modulesfilter (2501c14687, under Losses).0331deb61cvsmain, 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;mainfails that build.0331deb61cvsmain): 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].mainda2adec76d; 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.0331deb61cvsmain0b6d4f3f6b, 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.5dd914a2f9) ships its helper once in a Start client with server fns. Againstc99ee06725(bytes identical to0331deb61c): 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 againstmain, vue-start.full at +3 and solid-start.full at +2 (not re-measured at the head). Thefullfixtures 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.ad2b1855ccvsmaine7358c36d8,.js/.mjssummed 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__roota 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.main's compilers,80d1890bed).fails)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
srccoverage 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'snode_modulesfilter and the fixes from that review of the core, the router, the hosts and Start (each with its own tests). The previous runs were at0331deb61cand2322af5907. 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
8014d07f4e8014d07f4e0331deb61c8014d07f4emain(12,337 corpus route files, 156 fixtures)8014d07f4e0331deb61con both sides. 12,113 corpus rows equal or better. 30 have more eager bytes thanmain: 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 wheremaincopies it, minifier naming, one string component now split). 45 split fewer options, the same recorded set as in earlier runs. 3 fail only onmain, 146 on bothmain(161 probes, 8,359 corpus files; leaks, imports, kept statements, bytes, run trace)8014d07f4e2322af5907<Hydrate>againstmain(2,312 records)8014d07f4e2322af5907, failing kinds are the recorded limits8014d07f4e2322af5907except one probe's split chunk, by the anonymous default class fixclerk-basicfails onmaintoo)8014d07f4e0331deb61c.main: 2 (a marker leak, pinned)vite build --sourcemap2322af5907main): no new exposure8014d07f4e0331deb61c; againstmain, 12 identical and 6 smaller in gzip (before the server-fn client stub: "Client bytes" under Performance)main(52 fixtures × 3 groupings)8014d07f4e2322af59078014d07f4e8014d07f4e8014d07f4e8014d07f4eKnown flakes:
hotUpdatehooks run is cached with the old timestamp, so the module exists twice. It fails onmaintoo when forced; an upstream draft isn't filed yet.serialization-adaptersstream: the router's$_TSR.e()deletes$_TSRbefore Solid's last script reads it. It fails onmaintoo (about 1 run in 4). It isn't a compiler bug and is out of scope here.Beyond the oracle:
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.mainand with this PR, in a network-restricted sandbox.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 thatmainrefuses;mainanswers 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 (
b25984c166vs npmmain):390ca815c3.main's behaviour), a Vite optimizer race that exists without the PR, and noise.Fuzzers:
mainand four times by the PR): 0 crashes or nondeterministic outputs.main. The remaining differences exist onmainor are upstream (Editing a module that renders <html> (SSR + hydrate) throws "template is not a function" and breaks HMR solidjs/solid-refresh#91, Module that stops registering components (e.g. becomes a re-export): old proxies point to themselves, stack overflow solidjs/solid-refresh#92).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 onmainsince #8870.Remaining fail pins (55)
Each pin asserts the correct outcome and fails today.
oracle/KNOWN-BUGS.mdhas the details and the accepted limits that aren't pins.main: route CSS is eager (applying it only once the route matches needs a per-route asset loader, a follow-up).main(the "Not covered" row).All 55 pins by reason
main's behaviour on purposemain.srcDirectory/includegets 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.<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 onmainon Vite. A default production build inlines the template and builds, except on Vite with<template src>.RoutefromcreateFileRouteto an app's own helper shows in place. It needs a reload, as onmain.main?workerimporting a denied file;new URL('./x.server.ts', import.meta.url); a marked.mdx/.vuewith an asset query; a marked file that doesn't parse with an asset query; on Rsbuild, a plainwebpackContextof a denied.json. They reach the client unreported..pageasjavascript/auto) importing a denied specifier is reported. Rspack rules select by resource.Duplicate routes found) (vitejs/vite#24046).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).mainshows neither.bundledDev, a factory that becomes a server-fn builder drops its handler from the client bundle. This needs the full-bundle API.withBuilder(createIsomorphicFn().server(f)).client(g)keeps each implementation..server()finished the value, so nothing refuses it and the module throws at load, as onmain. No server code ships.main<Hydrate>children,ref={field}naming a module-levelletbinds theletthe module reads. It binds the chunk's copy, so the module's own code readsundefined: a JSX ref isn't an assignment before Solid lowers it, so the module-write refusal misses it. Workaround: aletin the component, orsplit={false}.main)<Hydrate>children passing the component'sargumentsas a shorthand property ({ arguments }) render its props. The chunk's rewrite ofargumentsis a text edit that doesn't see the shorthand: React gets the keytsrArguments(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
main0b6d4f3f6b, run on both sides unless it says otherwise.main, acceptedmainmay need a change, or an accepted limitmainmainfailed, shipped server code or showed stale codemainhas tooThe 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-cliandreact-router,solid-routerandvue-router,start-client-core). It also editsstart-server-fn-custom-id-check.md, which is already onmain.Different from
main, acceptedStart: server functions and builders
.inputValidator()fails the client build at the call.mainstill 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.A client-only
createIsomorphicFn().client(fn)orcreateMiddleware().client(fn)passed to other code fails the client build, as a precaution;mainbuilds it.Or pass the middleware to
.middleware([…])orcreateStart's lists directly.A builder's options object passed on, written to, or read for its
middlewarelist fails the client build;mainbuilds these..optionsis typed read-only.A server fn whose handler is itself
createClientOnlyFn(…)throws when called (… can only be called on the client).mainran the client implementation on the server.A Vite build whose
ssrenvironment builds before the client fails, saying to build the client first. Onmainit builds a server that answers no server fn. Start's ownbuildAppis unaffected.A
virtual:module with aserver-onlymarker (an id without\0) fails a Vite build, naming the module.mainbuilds it. Fix: move the code into a file.Kits that list Start under
dependenciesare excluded from Vite's dependency optimizer, like peer kits: a CommonJS kit, or a kit's CommonJS dependency, needs anoptimizeDeps.includeentry.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).mainloads each handler, and its file a second time, on the first call.A class,
enumornamespaceonly a handler reads runs at the first call on the server.mainruns 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 returningonOpengets'ready';mainruns 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 (
undefinedin a Vite build).mainfails 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) }, whereupdate()setsmethod = 'POST', the chain readsmethodfirst and the server fn isGET.mainfails 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 assignsselectedelsewhere, runs whatselectedholds at the first call;maintakes the value when the chain is created. The build warns at the argument. Fix: pass a function written in place, or aconst.A server fn that reaches the browser only as data (a loader returning it) is no longer callable over HTTP in production builds;
mainanswers it. Fix: reference it from client code.Vite: a server fn of a
node_moduleslibrary the app doesn't list inpackage.json, called during SSR, throws (500).mainrenders the page without the value. Fix: declare the library.Ids that a custom
generateFunctionIdmakes 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,serverFnMetaand 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 byiso().handler(h)shipsh.Vue
<script setup>: the 4 pinned shapes above; two of them built onmainon 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").mainbuilds 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
Reactin scope and throwsReact is not defined.mainrenders 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.mainbuilds it and serves the route (run on Vite, router-only and Start, with a second call holding onlystaticData). Fix: one call per file, bound toRoute.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 itsserver,ssrandheadersship to the client with no warning.mainfails each of these builds, router-only and Start (Vite): its generator adds an import ofcreateFileRoutefrom the router package to the route file on disk, and the duplicate binding stops the build. Fix: importcreateFileRoutefrom the framework's router package.A value import used only in types is in no output under
verbatimModuleSyntaxonce the code naming it is split;mainloads it. A module imported for its side effects needsimport './x'.A
constthe source reads only in types is removed when split code reaches it, and its initialiser doesn't run;mainruns it. A class,enumornamespacethat removed and kept code both name only in types leaves with the removed code. Fix: read it by value from code that stays.A
vardeclared inside a top-level statement that a split option reads runs when the route loads;mainruns it when the chunk loads.In a route file with a value
export * from …, a target's export namedtsr$<name>can be shadowed: when splitting makes the route module export one of its bindings to a chunk, the glue name istsr$<name>, and the module's own export wins over the star's.mainhas no glue exports. No corpus route file has such an export. Fix: don't givetsr$-prefixed exports to a module a route file star-re-exports.function Unused() { return <Page/> }keepsPageeager whenPageisn't a plain function with effect-free imports: code nothing uses stays for the bundler.mainhasPageonly in the chunk.Route files under
node_modulesaren't split, on Vite, webpack and Rspack, with one warning per file: aphysical()mount of an installed package, or a routes package resolved withresolve.preserveSymlinks.mainsplits 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.
node_modules, and of no dependency module.mainput unplugin's loaders in every module's request, dependencies included.mainthe requests hold unplugin's loader path instead.mainto 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 onmain.<Hydrate>More refusals (the build fails at the code;
split={false}keeps the boundary in place).mainbuilds them and the split children work on a copy or a snapshot:React.useId(),Route.useLoaderData()). Move the call into a child component.usewritten directly in the children,use(Context)anduse(promise)alike (also renamed, or asReact.use). Onmainthe call moves into the split component, whereuse(Context)reads another context than on the server (a hydration error). The error points at the call, for every hook.letthe component reassigns, also through a nested<Hydrate>. UseuseRef.new.targetin the children, and a nested Solid boundary assigning an outer local throughref.Split children passing
argumentsas a shorthand property ({ arguments }) get the keytsrArguments(React: a hydration error) or fail to parse (Solid).mainrenders them. Pinned, below; write{ arguments: arguments }.A hook only a
<Hydrate fallback>reads is dropped on the server in every file.mainkeeps it outside a route's split component. A browser-only hook no longer crashes the server render; a hook taking an id (useId, Solid'screateUniqueId) shifts the ids after it, as with<ClientOnly>children onmain. Fix: call the hook in a component inside the boundary.Import protection
allowImport(info)decides,onViolation(info)reports (breaking).Returning
falsefromonViolationno longer allows an import: the import gets the normal outcome and Start points toallowImport. Onmain,falsesilenced the report; a marker file then shipped for real and a.serverfile stayed mocked.allowImportruns once per import before the mock replaces it, in dev and builds;truegives the real module with no report. Itsinfohas notraceorsnippet.An importer that
excludeorignoreImportersexempts gets the real module of a denied file it imports plainly.maingave 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).
mainbuilt it on Rsbuild and on Vite withmock. The error names the file, both importers and the two fixes.Rsbuild builds with
errorfail on pattern imports of a denied file (templateimport(),import.meta.webpackContext) and on a denied import in a worker built by a child compiler.mainmocked both silently.Route generation
routeTree.gen.tsformatting changes once. The file is printed in yourquoteStyle/semicolons, andenableRouteTreeFormattingnow defaults tofalse(trueuses Prettier, loaded lazily). If a formatter runs over the file, ignore the file or set the option totrue; otherwise the generator and the formatter rewrite each other's output.mainbuilt with the tree on disk, without the route. Start builds andtsr generatealready fail onmain. Dev and watch report the error and keep the last good tree.Dev servers and HMR
mainrecovers 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.codeSplitGroupingsresets the component's state;mainkeeps it.loaddidn'taddWatchFilethe edited file (for exampleinvalidateModuleand afull-reloadfrom the plugin's own watcher). In Vite bundled dev and withserver.hmr: falsethere is no hot update to read, so any regeneration is missed there.maindoesn't read a virtual module's exports, so its compile doesn't depend on them.mainshows 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):
vite@rsbuild/core@rspack/core, for react-start-rsc@babel/coreno longer comes with the router plugin or Start: declare it if a plugin of yours needs it (e.g. React Compiler).Removed:
compilerTransforms,serverFnProviderModuleDirectivesandStartCompilerPlugin;react-start-rsc/plugin/rscCssTransform, replaced byrsc: { loadCssExpression, providerDirective };ssrIsProviderofTanStackStartCoreOptions;format,inferFullPath,checkRouteFullPathUniqueness,writeIfDifferentandafterTransform, and theGenerator's undocumentedfsoption (it reads and writes route files directly).onRouteTreeChangednow 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.mainaccepted 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/hmrand@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
mainItems that begin with Fails the build stop a build that
mainlets 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).
mainbuilt these and shipped the handler to the client in most of them (16 of 21 shapes run):const h = createServerFn().handler,.call,.bind, an unknown method;ifwith tworeturns, an async function, a method, a getter), aletbuilder reassigned with something else, a builder in a TSnamespace, a project namespace passed around when its module exports a builder;(fn) => createServerOnlyFn(fn),({ handler }) => createMiddleware().server(handler).More builder shapes compile. On
maintheir handlers shipped to the client:const { createServerFn } = Start,(0, createServerFn)(), a builder chosen by?:,??,||or&&, a factory with statements before its singlereturn,export * as ns, a factory twoexport *branches reach under two names of one binding (export { api as a, api as b }), a factory exported as'*'.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-levelawait. On Vite,mainfails all of them (createServerFn must be assigned to a variable!); on Rsbuild,mainbuilds them, ships the handler to the client and registers nothing.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 onmaintoo, without the position; on Rsbuildmainshipped the handler; in<script setup>on Vitemainbuilt 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
mainthat call fails withServer 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
maina 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 withoutput.minify: false; see Not guaranteed). The code of its chain (options, middleware arguments) still runs. Onmainits 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.maincalls it withobjasthis.createServerOnlyFn(…)orcreateIsomorphicFn()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); onmainthe whole app answers 500.A class,
enumornamespaceonly server code uses leaves the client, with its imports, and so does a declaration that removed code names only in a type (typeof cfg).mainkeeps 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 onmain, which says nothing.Kits that list Start under
dependenciesare compiled on the Vite server, like peer kits. Onmaintheir server fns returnundefinedduring SSR.vite build --watch: the server builds after the client's first build, so the first build answers server fns (onmainit 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; abuild.watch.excludematching 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, outsidenode_modulesand allowed byserver.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 answersInvalid server function IDinstead of aTypeError. 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;
mainkept failing until a restart. Withserver.hmr: false(Vitest), a module whose import became a server-fn builder is recompiled;mainkept the handler in the client module.Fails the build (RSC):
renderServerComponentorcreateCompositeComponentoutside a server function, at the call. Onmainit 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,createCompositeComponentorrenderToReadableStreamthrough?:,&&,||or??gets its CSS on each operand that can be the JSX rendered.mainadds the CSS only to a JSX argument written directly.Rsbuild:
@rsbuild/plugin-vue(mainfails the build of an SFC that imports Start);performance.buildCache, a build after an edit names the new client entry (onmainevery page links the previous build's entry and never hydrates).A route whose
serverhandlers are in its route file and whose page is in its.lazyfile stays in the client route tree, on Vite and Rsbuild, so client-side navigation reaches it. On Vite,mainprunes it.Symlinked route files are compiled: their
serverhandlers are removed from the client (Start: symlinked route files skip the client-sideserver.handlersstrip — server code and node-only imports ship in the client bundle #8514), they split, and the document links their split chunks' CSS.mainserves them as written. When two route files link to one file, the generator gives the second its own file, as onmain, 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
Routefails with the generator's error.mainserved it as written, itsservercode included.Start's Vite plugin order no longer matters for React:
tanstackStart()may come after@vitejs/plugin-react, wheremainfails with a plugin-order error. Solid still needstanstackStart()first, as onmain.Route files and code splitting
Values
mainfails to compile stay in the route module and work: a member access (pages.Home), a namespace member,satisfies,!, a class, an array-pattern binding, a sequence, and a call holding JSX or TypeScript syntax (memo(() => <p />);memo(Page)splits).An object-form loader splits its handler (router-plugin: object-form loader breaks the code splitter when loader is split #8753):
handlersplits like a function loader, and the object with its other keys stays in the route module. A loader object held by a localconststays whole and works.mainfails the build when the loader is split.An option whose chunk would assign a variable it shares with the route module or another chunk stays in place.
mainfails the build (Cannot assign to import).Options written as methods split (
component() {…}, Code splitter does not support the method shorthand syntax #8623).A function using its own
thisorsuperstays unsplit, with a warning (Handle route callbacks that reference this during code splitting #8688).mainsplits it and calls it with anotherthis.Already-unused declarations run once.
maincopiesconst unused = register('x')into every chunk and runs it again.Route options named through several
consts or a cast are split and their server options removed. Onmainthey are neither, andserverships.deleteNodesremoves what only the removed options read from every output, split chunks included (a destructuring default only aserverhandler reads). It also applies withautoCodeSplitting: false, where it does nothing onmain.A server fn written in place as the
loaderis compiled, and the page gets its value. Onmainthe handler ships to the client and the loader returnsundefined, with the default groupings and withloaderin the groupings (Vite build). It isn't split here either; withloaderin the groupings a warning (split-claimed) says so.Route options the compiler can't read warn, saying what to write: a spread, options from a call or an import, options written to after their declaration, a computed key. What they hold isn't split or removed, so server code in them ships, as on
main, which says nothing.A route made in an app's own factory function is served as written, with a warning naming the cause.
mainsplits it and the page throws.A
Routethat isn't one variable (destructured, declared twice) is served unsplit with a warning.mainleaves a destructured one out of the route tree and fails the build on a repeated one.Other shapes that fail or break on
mainbuild and work: a chunk or shared module compiled before its route file (router-plugin: split chunk and shared module miss shared bindings when compiled before the route file #8754), two@babel/traversecopies (router-plugin: a split route option that is also a shared binding exports an undeclaredSplit…when two @babel/traverse copies are installed #8715), exports of a split route (Compiler correctness: split-route exports and distinct re-export aliases #8505), an imported component used ascomponentandpendingComponent(autoCodeSplitting: imported component used as both component and pendingComponent is left undefined (ReferenceError) #8914), project paths with'or#(Code-splitter breaks every route when the project path contains a single quote/apostrophe (autoCodeSplitting: falsedoes not avoid it) #7754).Production source maps name a split chunk's source by the route file's path, not
route.tsx?tsr-split=….Route generation
@tanstack/router-plugin/esbuildgenerates the route tree at each build start and rebuild. Onmainan app without a committed tree fails to build.mainit fails route generation and the build.'/x' as constis kept in sync.createFileRoute(path), andcreateFileRoutein__rootbecomescreateRootRoute.// @ts-nocheck,// @ts-checkor/// <reference …/>stays first when the generator adds the router import to a route file.mainputs the import above it, and TypeScript then ignores the directive.routeTree.gen.tsis written again, and edits of the virtual route config and of__virtual.tsfiles are picked up. Onmaineach of these leaves a stale tree undertsr watch..tsroute files get a scaffold without JSX (Empty .ts route file is scaffolded with JSX, breaking all route generation #8480)..lazy.vuefiles androute.component.vuepieces belong to their route.tsr watchand the Rspack and webpack plugins watch every route root,physical()mounts included, andvite build --watchpicks up new route files. Siblingphysical()mounts no longer declare one identifier twice (router-generator: siblingphysical()subtrees in a virtual route config generate duplicate identifiers #8879).tmpDiron another filesystem (EXDEVonmain) and a deleted.tanstack/tmp(git stash -u); onmainevery later route change fails until a restart.tsr generate;mainexits 0 and writes the tree.<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.use*()functions directly and are split;mainfails the build on a bareuseX()call.awaitoryielddirectly 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
<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>),createClientOnlyFnfor a function.mainprints a generic hint. A marker violation names the position of the marker import (src/count.ts:3:8).!exclusion. On Rsbuild, traces start at the app's first file instead of Start's client entry.mainis silent.?rawof a file with aserver-onlymarker serves the mock;mainships its text.mainis silent.mainit is silent.Route HMR
const Page = flag ? Wide : Narrowand a layout import switched to another module are stale onmainuntil a reload. The router takes the new component after React Refresh's pass, and React Refresh alone decides whether state survives.mainis stale. Split chunks carry the route file's@refreshpragmas, 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.tsx) update in place, with React state;mainreloads the page. The page still reloads, as onmain, 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.mainthe page keeps the old loader's data.*.component.vuefile. Onmainthe page goes blank until a reload.Diagnostics
[tanstack-router]or[tanstack-start]prefix.mainprints 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.Not guaranteed (as on
main)Routefrom an app's own helper, or a file the generator doesn't list, is served as written; under Start itsserver,ssrandheadersship to the client. The same holds for what unreadable route options hold.import(),require()andimport.meta.globneither fail nor warn. Keep builders statically analyzable.Route.update(), code-basedcreateRoute({ server }), and a file read on purpose as text.mainmakes them:<Hydrate>chunk copies the module-level declarations its children reach, so a context, a store or a reassignedletexists twice (ten shapes in KNOWN-BUGS);letorvarthat 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-formhandler).Routethrough an import cycle, the page fails to load (on webpackCannot access 'Route' before initialization).output.minify: falseor Vite'sbuild.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 constantif (false)is removed by the default minifiers).createServerFn,createIsomorphicFn, …) under another name, or the whole router package from a package of your own (see the re-exportedcreateFileRouteabove), 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.maindoesn't follow the rename and ships the server implementation.loader: loaderObjectfrom another module) splits whole when the loader is split, and breaks at runtime. Write the object in the route options.tools.rspack: the SSR build fails for a.vuewhose<script>defines a server fn.@rsbuild/plugin-vueworks;mainfails every Start.vueon Rsbuild.Follow-ups
mainin splitting and<Hydrate>were kept out on purpose and are in the "What this rewrite unlocks" comment: splitting an option whose value the route file exports, one instance instead of copies in<Hydrate>chunks, an imported loader object.createServerFn({ serializable: true }).<Hydrate>boundary is inert on a fresh page (maintoo): it reports hydrated but its button ignores clicks, on Vite and Rsbuild production builds. It works after client navigation and withsplit={false}. The cause is in the Solid runtime, not the compiler. Nested split boundaries can also stall: on about half of cold loads neither gate hydrates, the inner chunk is never requested and a button outside the boundary stays dead too (Vite and Rsbuild,maintoo). Add an e2e that clicks a split boundary, and a control outside it, on a fresh page.<Hydrate>: the first click can be lost (maintoo, runtime, also withsplit={false}): with the default strategy a click right afterpointerenteris dropped, and withevents: 'click'the replayed click lands on the boundary's wrapper instead of the button. Touch devices hit the first case.let: a candidate closed rule keeps an option in the route module when its chunk would copy a binding that staying code assigns (the stale-copy limit under Not guaranteed). It costs a lost split when the staying writer never runs before the read; not taken here, to split asmaindoes.__rootcache group: unblocked now that [Bug]: Panic "Chunk not found in ChunkByUkey" when a splitChunks cache group is named like a webpackChunkName chunk web-infra-dev/rspack#16289 is fixed.solid-router/src/hmr-chunk-importer.tsandchunkImporterCallin router-plugin's split planner ([Bug]: lazy compilation:import()of a module that accepts its own updates keeps resolving to its first namespace web-infra-dev/rspack#16594);HACK(rspack#16567)batch inrouter-utils/src/compiler/hosts/rebuild.ts([Bug]: compilation.rebuildModule callback never called when the module's rule match changes or another rebuild removes it web-infra-dev/rspack#16567). The batch also works on 2.3.3; dropping it needs the plain rebuild path to accept 2.3.3's answer for a module another rebuild of the pass removed (an error, "no longer in the module graph").main; reusing it needs a sound "graph unchanged" test, likely an Rspack change set); the plain-module cost under Losses.tsr generatewrite different routeTree.gen.ts (Start footer added, then stripped) #8437 CLI half, server routes with a.tsextension gets the wrong boilerplate while creating the file. #4462, Vite HMR blank page when editing__root.tsx(Solid SSR) #6331 (Editing a module that renders <html> (SSR + hydrate) throws "template is not a function" and breaks HMR solidjs/solid-refresh#91), [@tanstack/react-start/plugin/rsbuild] tanstackStart() eclipses the client environment's output.assetPrefix, blocking downstream plugins #7827 andssr: falseroutes still bundle components in server output #6400.solid-start.fullserver scenario renders its error page andvue-start.fullan empty shell, onmaintoo. Fix them in a separate benchmark PR.url()of a denied file on Rsbuild builds a silent mock; import protection reports a dead re-export of a denied module with a top-levelawait.close(): [Bug]: objects captured by closeBundle remain retained after bundle release and repeated GC rolldown/rolldown#11444 (closed; the fix, fix: allow plugins to be garbage collected afterbundle.close()rolldown/rolldown#11467, is merged but not yet released).vite devwith@cloudflare/vite-plugin, a memoizedimport()started by a request that has already answered never settles: vite-plugin: a request abandoned by its client is cut off ~10 s later invite dev, and a dynamicimport()it started never settles, so every later request awaiting it hangs cloudflare/workers-sdk#16214.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.28.1, 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
_/$/Unicodeimport X = ns.Ymarks thensreference as a type position yuku-toolchain/yuku#229import X = ns.Yexportyuku-toolchain/yuku#230 decorators afterexportJSXText.valueis not entity-decoded yuku-toolchain/yuku#231 JSXText entities@yuku-core/wasmparses stale bytes for an empty source in WebContainers yuku-toolchain/yuku#244 WASM stale bytesunwrapfor any node, likeisWrapperyuku-toolchain/yuku#247unwraptypingmodule.copyAst(): a mutable copy of the analyzed tree that maps back to it [feature request] yuku-toolchain/yuku#248copyAst()export {} from "m"produces no module record yuku-toolchain/yuku#251export {} fromimport()/require()when the specifier is parenthesized or a plain template literal yuku-toolchain/yuku#252import()specifiers++operand followed by a line comment yuku-toolchain/yuku#255 postfix++parensfor (init;;)no-inrestriction leaks into parentheses and literals, misparsing or rejecting valid code yuku-toolchain/yuku#256for (init;;)no-inimport type {} from 'x'as invalidimport type 'x'yuku-toolchain/yuku#258import type {}super()in a nested class field's computed key yuku-toolchain/yuku#259super()in computed key</>is lexed as JavaScript, so<p><>a</> — b</p>fails to parse yuku-toolchain/yuku#260 JSX text after</>printdrops the parentheses in(a?.b)!.cand changes optional-chain semantics yuku-toolchain/yuku#287(a?.b)!.cJSXTextbuilt withb.JSXText({ value })is printed unescaped, producing invalid JSX yuku-toolchain/yuku#288 JSXText escapingprintignores an editedJSXText.value(the stalerawwins), unlikeLiteral: is that intended? yuku-toolchain/yuku#289 stale JSXTextrawprint(file, { strip: true })keepsexport { I }/export default Iof type-only bindings, so the JavaScript does not link yuku-toolchain/yuku#290stripkeeps type-only exportsfile.exportshas no record forexport namespace A.Byuku-toolchain/yuku#318export namespace A.Binfile.exportsVite:
Failed to reloadhotUpdatehooks run is cached with the old?t=, so a module that imports itself runs twice (behind a recurring route HMR test flake)vite build --watchdoes not close its watchers on Ctrl-C or SIGTERM (closeWatchernever runs) vitejs/vite#24181vite build --watchruns nocloseWatcheron Ctrl-C/SIGTERM, so Start's watch-build sentinel leaves its temp directoryexport *from a module still evaluating in a cycle never gets its later exports (undefinedwhere Node has the value) vitejs/vite#24183 module runner:export *through a cycle never gets a later export (undefinedwhere Node has the value)vite:afterUpdatevite build --watchexits 1 withENOENTbefore the first build is writtenvite buildexits 0 (same defect as [Bug]: RSC: build exits 0, but the app fails at runtime: a client component returned by a client-imported server action is missing from the client manifest web-infra-dev/rspack#16786)Rolldown:
vite build --watch(commented with a repro; an existing issue)this.load()returns null in bundled-dev HMR@__NO_SIDE_EFFECTS__is ignored for functions exported withexport { fn }rolldown/rolldown#11221@__NO_SIDE_EFFECTS__onfunction f+export { f }is ignored across modules (commented with a cross-chunk repro; an existing issue)moduleSideEffects: falseafter its hooks stop returning it rolldown/rolldown#11223 stalemoduleSideEffectsin watch modeimport()of a never-loaded chunk throwsMissingFactoryErrorwithdevMode.lazy: falserolldown/rolldown#11300 bundled-devMissingFactoryErrorupdaterolldown/rolldown#11648 a file removed and re-created within 100 ms keeps failing to resolve in Vite's dev serveroutput.topLevelVar(which Vite 8 sets) turns a top-levelusing/await usingintovar, so its disposer never runswatcher.close()before the watcher is created is ignored: the build runs and the process never exits (also through Vitebuild({ build: { watch } }))Rspack:
sourcesContententries are emitted as""instead ofnullweb-infra-dev/rspack#16347 a missingsourcesContententry is emitted as"", notnull(fixed in Rspack 2.3.1)sourcesContentfrom the module resource when emitting source maps web-infra-dev/rspack#16348 feature: fill missingsourcesContentfrom the module resource at map emission (closed with no small, robust fix: a map's text must take part in HMR invalidation)rebuildModule's callback is never called when the module's rule match changes (fixed in Rspack 2.3.3; worked around here below it)assertion failed: self.backup.is_some()in the compilation after one whosefinishMaketap rejected web-infra-dev/rspack#16578 the compilation after one whosefinishMaketap rejected panics (fixed in Rspack 2.3.3)attempt to steal from stolen value: BuildModuleGraphArtifactaftercompilation.rebuildModule()answers an error web-infra-dev/rspack#16579 arebuildModulethat answers an error panics the compilation (fixed in Rspack 2.3.3)import()of a module that accepts its own updates keeps resolving to its first namespace web-infra-dev/rspack#16594 lazy compilation: a laterimport()of a self-accepting module answers its first namespace (fixed in Rspack 2.3.3; worked around for Solid, wrapper emitted on every version)maintoo)finishMaketap that rejects before stage 0 hangs the build at 100 % CPU instead of failing it (fixed by fix(rsc): unblock compiler shutdown after a fatal build error web-infra-dev/rspack#16818, not released yet)VirtualModulesPlugin.writeModule()inthisCompilationof a fresh compiler is ignored, so the build keeps the cached content (fixed by fix(cache): honor virtual module writes in thisCompilation web-infra-dev/rspack#16820, not released yet)rebuildModule()the next build links imports to the wrong modules (an RsbuildbuildCachebuild after removing a server function underbuild --watchfails; a fresh cache builds)Rsbuild:
SWC (Rsbuild's transform):
await usingleaves laterexport const/let/vardeclarations after the disposal, so the disposer hits a TDZ(new F)()is printed asnew F(), dropping the call (the PR printsnew F()for an argument-less keptnew, so Start's output is unaffected)solid-refresh:
__root.tsx(Solid SSR) #6331)chokidar:
changewhen the new target has the old one's mtime and a later atimeOthers:
\nas a line break (lone\r, U+2028, U+2029 ignored) Rich-Harris/magic-string#368 only\ncounts as a line breakmoduleCache: falsedoesn't reload an edited.mjsor.cjsconfig, so a native JS virtual route config keeps its first version until restart (commented with a jiti-only repro; an existing issue)typeof xtype query keepsxalive pcattori/babel-dead-code-elimination#50typeof xkeepsxTextEncoder.encodeInto('')returns the previous call's{ read, written }stackblitz/webcontainer-core#2173encodeInto('')returns stale datamemo(Page as any)andmemo(Page!)are not registered oxc-project/oxc#29281 React Refresh doesn't registermemo(Page as any)(fixed in oxc 0.159.0; no Rolldown release ships it yet)oxc-parserleaks native memory on everyparseSynccall; hit in our own tooling, not in the PR's code, and commented there (fixed in oxc 0.159.0)enqueueUpdate(callback)drops the callback while a refresh is pending rstackjs/rspack-plugin-react-refresh#146enqueueUpdate(callback)drops the callback while a refresh is pending (fixed in 2.0.3)pnpm run dev -- --config) tanstack.com#1353 the playground drops Start configIssues
server.handlersstrip — server code and node-only imports ship in the client bundle #8514autoCodeSplitting: falsedoes not avoid it) #7754Split…when two @babel/traverse copies are installed #8715autoCodeSplittingis enabled #6667physical()subtrees in a virtual route config generate duplicate identifiers #8879bundledDev: true#7535.andhandler/server/client, silently disabling transform after AST-roundtripping pre-plugins #7280Each of these was reproduced on
main0b6d4f3f6band run again on this branch, except five:autoCodeSplittingis enabled #6667, whose fix is fix(router-plugin): point split routes' source maps at the route file #8860, a PR split out of this one and merged early.mainno longer shows. Each one is closed by a test here that reproduces its shape:bundledDev: true#7535 (SSR runs an edited module in bundled dev) and start-compiler-plugin fails to lazy-load dependencies with Vite bundledDev #8407 (a server-fn module calling a dependency at load bundles in bundled dev):mainworks since fix(start): preserve dev SSR CSS order #7830. Tests:start-compiler-dev-server.test.ts, "SSR runs an edited handler, called directly and by id" and "a server fn module with a top-level call of a dependency bundles for the client without its handler"..andhandler/server/client, silently disabling transform after AST-roundtripping pre-plugins #7280 (whitespace or a comment between.andhandler):mainallows it since fix: whitespace in server function .handler() not matching compiler regex #6216. Test:createServerFn.test.ts, "a handler called with a newline after the dot is extracted" and its four siblings, with the builder in the module and in another module.mainwith Vite 8.3.4 or 8.2.1. Test:start-compiler-dev-server.test.ts, "a module whose factory becomes a server fn builder bundles again without errors".Other issues:
mainno longer fails the October repro (0 of 10 runs on Vite 8.2.1). A test here covers concurrent first calls of one server fn whose handler's imports load slowly (start-compiler-dev-server.test.ts), not the issue's server fn calling another.physical()subtrees in a virtual route config generate duplicate identifiers #8879: the build no longer fails (taken names get a numeric suffix, e.g.Index2Route). The issue's preferred names (AccountsIndexRoute) are fix(router-generator): include the parent route path in variable names for physical() mounts #8880's change, which still applies after merge.export { component as View }the option is split, soView !== Route.options.component.tsr generatewrite different routeTree.gen.ts (Start footer added, then stripped) #8437, partially addressed: Start's footer followsquoteStyle/semicolons, buttsr generatestill writes none.main.strictExecutionOrder: trueonssr.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):
{ read, render: pending }), identity after a loader-only edit.autoCodeSplittingwith esbuild is still refused, as onmainsince fix(router-plugin): throw on autoCodeSplitting with esbuild #8852.export { Layout as View }the option is split, sooptions.component === Viewdoesn't hold; the loader alias is untested.mainthrough fix(start-plugin-core): Rsbuild manifests list only a route's own chunks #8876.console.errorfor an uncompiled factory reaching the browser stub, hooks recognised by binding, warnings for<Hydrate>children from a spread and for getter/setter split options.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 Vitestart-router-pluginpiece), 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
mainand could be closed.How to review
The diff against
mainis 2,344 files. Tests and the test harness are 1,686 of them (the oracle fromcompiler-tests/baseline, plus this PR's suites), and regenerated route trees are another 198. Product code is 249 files inpackages/*/src.router-utils/src/compiler/README.md, then readidentity→source/analysis→units/mutation→rewrite→placement(withclustersandreads) →plan→emit→values/summary/facts→cache/pipeline→verify. Keeptests/helpers.tsandtests/placement.test.tsopen alongside.router-plugin/ARCHITECTURE-CODE-SPLITTING.md, thensrc/planners/.start-plugin-core/src/planners/(start-env,hydrate,rsc-css,edges), withsrc/compiler/,src/server-fns/andsrc/import-protection/. Builder escapes:ESCAPE_MESSAGESinstart-env.tsandtests/start-compiler-builder-shapes.test.ts.router-plugin/src/hosts/.src/vite/compiler-plugin.ts.src/rsbuild/(readCOMPILER_ARCHITECTURE.mdfirst).router-generator(AGENTS.md,analyze/,model/,print/).router-core/src/hmr.tsand{react,solid,vue}-router/src/hmr.ts;solid-router/src/hmr-chunk-importer.tsis the temporary Rspack workaround.README.md,SPEC.mdandKNOWN-BUGS.md.To reproduce the measurements, see:
packages/compiler-test-utils/oracle/README.mdbenchmarks/compiler-perf/README.mdpnpm benchmark:bundle-size:runscripts/benchmarks/bundle-size/server.mjsThis 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