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: f26bfaa 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 f26bfaa
💡 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
|
Merging this PR will regress 1 benchmark2 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting 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
|
… with its record as the sink Rsbuild's loader hands its modules to `StartCompilerSession.transform` like Vite's hooks: the main pass, the late pass (D-30's admission: a Start-declaring package's module, or the main pass's rule) and the asset pass, with a child compiler's module as its own instance. Its `record()` is the session's sink: every answer writes the module's `buildInfo` parts (current or not), and only a current one commits. Which modules hold a record is the session's committed-id set (Rsbuild's `recorded` is gone), kept by the sink and the restore scan; a child's passthrough no longer retires the compiler's import protection record. A module Rspack types as an asset (`asset/source`) is judged as an asset and never compiled (S5-10); the late pass's code the compiler cannot parse fails the client build, as on Vite. Deleted: Rsbuild's `ModuleOutcome` (its record takes the session's outcome and `ModuleRecord`), `recorded`, `notCompiled`, `protect`, `diagnose`, `NOT_COMPILED`; the session's `settle`, `afterCompile`, `assetOutput` and the public `late` input; import protection's `afterCompile` and `buildInfo(id, out)` (now `buildInfoOf(record)`). Import protection's edge states leave `served` for a map of their own (`edgeStates`): `served` holds only the modules that are their own violation. Rows: `start-build-late-pass.test.ts` "rsbuild build, an MDX module the compiler cannot parse" and "rsbuild build, an MDX module imported as its text" (S5-10), both red before. Settlement design rev 4, step 4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The Rsbuild host keeps its own index of which modules' `buildInfo` holds parts (`recorded`, by resource and instance, as long-lived as the compilers' modules, restored from `buildInfo` with a child's instance on a cache restart); `record()` reads only that. The session's commit alone writes the committed-id set, for current answers only: `keepsSet` and the session's `hasCommitted`/`noteCommitted`/`dropCommitted` are gone. Two modules of one id (`role.ts`, `role.ts?url`) and a restored child module clear their own records again; a restored child no longer joins `fnModules`. - One sink for a module and an asset: a failed asset records its located errors, so it fails as import protection's report, not as a loader crash. - `transformAsset` decides on the outcome (a non-denied asset commits nothing and enters no set) and calls the sink without import protection too. - The bundler's module type (`ScriptRequest.typeOf`, asked of an admitted module): a type that is no script (`json`) is the host's, left as it is. - `transform` takes the host's identity; `recordKey` runs after the early returns with the id; `StartCompilerSession.report()`, `fail()`'s `overtaken` and `served()`'s `key` deleted; stale comments and COMPILER_ARCHITECTURE.md updated. Rows: `asset-dev-error-rsbuild.test.ts` (red before: Rspack's "Module build failed" wrapper), `start-build-late-pass.test.ts` "rsbuild build, a module the app types as JSON" (red before: the late pass parsed the JSON as JSX). Settlement design rev 4, step 4 (reviews: Fable, Astra, Gemini). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…differ The loader's `typeOf` read `ctx._module.type` for every admitted module: 2,091 binding calls per build of compiler-perf react-start, the +1 % of the Rsbuild build. It is asked now only of a late-pass module or one whose request carries an app query (`?raw`), never of a derived output (`?tsr-split`): 0 reads in that app, `_module` gets back to base's 3,777; `buildInfo` gets, sets and deletes were already base's (the write is gated by `recorded`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`new URL('./sample.js', import.meta.url)` makes the file an
`asset/resource` through Rspack's own `dependency: 'url'` rule, with no app
rule; since the loader reads the module type only for the late pass and
app queries, Start's main loader compiled it and the emitted asset was
Start's client output. Start's main and late loader rules now carry
`dependency: { not: 'url' }` (child compilers take the same rules), and
the asset pass, whose `new URL` rule no longer excludes scripts, judges a
script Rspack types as an asset (one type read, for a script id there)
instead of leaving it to a loader that no longer sees it.
Rows: `start-build-late-pass.test.ts` "rsbuild build, a script new URL()
makes an asset" (red on 2a5ba1a: the client's isomorphic fn);
`asset-query-scope.test.ts` "a denied script, new URL" (build and dev:
guards the asset pass's verdict, which the rule condition alone dropped).
KNOWN-BUGS: a script an app rule types as an asset by its path alone is
compiled, as before step 4.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…led, as on base Reverts 9f86d4a's loader rules (`dependency: { not: 'url' }` on the main and late rules, scripts in the asset pass's `new URL` rule) and the asset pass's type read: each fix to the `new URL` path opened another shape (a JS-typed `new URL` module not compiled; a script both imported and loaded by `new URL` losing its violations; a denied JS-typed one unreported), for a case that behaves as base f184a99. The loader is 2a5ba1a's again. KNOWN-BUGS: a script that becomes an asset with no query (`new URL()` through Rspack's default rule, a by-path `asset/source` rule) is compiled when its text names a Start API; a query keeps the text. The loader comment says the same. The exact-text row is dropped; the rows "a denied script, new URL" (build, dev) stay, green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…or slow agents Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every type position in code that stays (Yuku's `inTypePosition`) seeds the removal closure as erased text, whatever holds it: an annotation or a cast of running code, a type argument, an overload signature, an abstract or `declare` member. A value only types name leaves with its initializer, in every environment (user decision, 2026-11-25). Two exceptions, the decided ones: a named erased declaration (an alias, an interface, a `declare`) is read when it is named or exported (D1, T5-T8; `Declarations.inNamedDeclaration`, and `exportedErased` for main's `stripTypeExports`: a local of an export, a member of an exported namespace, dotted or nested), and an import is the host's (`verbatimModuleSyntax`). Decorator metadata stays a read by value (`metadataNames`). The pass runs where a type position names one of the module's values (`Tier1.typesNameValues`, from the Tier 1 reference loop). Gone: `Declaration.signature`, `Unit.typeExport` and its unit arms, and closure's type-export parts, which this rule replaces. `export type * as Ns` exports nothing; hmr's type-only import check reads `stripped`. Rows: the follow-up's removal, import-protection and ambient-export rows come over; the ones the decision changes are replaced by rows of the new behaviour (a local value only an overload signature names, a running function's annotation, erasure's local-type and class-as-type rows, the typeof type query, the route module's declaration only a type names); the ambient forms nothing names and an exported `declare class`'s heritage go back to the landed outcome (KNOWN-BUGS). New: decorator metadata on Vite and Rsbuild. Changeset and guide sentence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Type export syntax and exported erased declarations are removed text in every module again (no longer behind `typesNameValues`): an import only an exported type names leaves, as on a0f6fcc. - An import that only types of code that stays name is the host's through any chain of aliases: `follow` reads a declaration for its imports only from removed text, so the pass is exact where no type names a value. - A classic JSX pragma's factories (`@jsx h`, `@jsxFrag`) are value reads where JSX is, from the header's pragma pass. - Decorator metadata reads the constructor a keyword type serializes to (`string`: the module's `String`), as Oxc and SWC emit it. - The self-check takes no free read inside ambient text (the heritage of a `declare class`). - Linear: removed and ambient ranges are a sorted cover, and the scopes around a text come from a scope tree. - A merged `declare const x` + `type x` is ambient text (T7). - Docs: a class only types name is removed with its decorators and static blocks (user decision, accepted as built). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…flags allow an erased one `exportedErased` now runs in every module: a binding without the ambient, type, namespace or import flags (and no `declare` beside its definition) has no erased declaration, so its rows are not built. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The exported erased declarations are looked for only in a module with a type unit of its own or a namespace block: elsewhere there is none. - The scope index is built from one numeric sort into typed arrays (still on the closure's first read of a nested text). - The HMR refresh check tests that every unit is a type before it looks for a stripped one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the type rule - Decorator metadata: a class that emits it reads, where it is defined, the module's own binding of every global metadata can name (TypeScript's serializer's set: String, Number, Boolean, BigInt, Symbol, Object, Function, Array, Promise), instead of mapping type shapes case by case. Class type references keep their promotion. - Classic JSX by config: a `React` of the module's own is read where JSX is (an imported one is the host's). - A `declare` stays as written: its text (and a cluster of type units) reaches an import only when removed text leads to it (`REMOVED` cause), as on a0f6fcc and main, so an import a staying type names through a `declare` is the host's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… own React to main's behaviour The user's decision (A″, narrowed): "we need to be reasonable, we will never cover the entire syntax". In a module with decorators (what their metadata reads is the emitter's) or a non-import `React` binding in any scope (a classic JSX runtime the bundler may be set to calls it), `typesNameValues` is false: types keep what they name there, as on main, and what only server code reads still leaves. - Deleted: the metadata globals set and its reads, the classic-by-config `React` path, and their rows. Kept: `metadataNames` and its lookup (it now also says whether the class has a decorator), the `@jsx` pragma factories (read from the header's pragma comments), the ungated fixes. - Rows for the comparison with main: a shadowing `Number` and a `String` only server code reads leave; a function-local `React` only a type names stays; a class a decorated `Two | never` names stays. - KNOWN-BUGS: decorated and own-`React` modules keep what types name; a config factory other than `React` with no pragma can leave. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…act members close the gate - The `@jsx`/`@jsxFrag` factory is the pragma's whole identifier as JavaScript defines one, Unicode included (`hΩ` was cut to `h`). - A decorator on an abstract property, accessor or method is a decorator: `metadataNames` reads those members, so the gate closes and SWC's metadata for them keeps its class, as on main. - `metadataNames`' comment no longer claims what unions serialize to. - KNOWN-BUGS: a local alias of an imported `React` only types name leaves under a classic runtime set by config. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the generation `stable(snapshot)` is the one check of a plan's dependencies for an attempt before publication, a plan hit and `restorePlans`: it asks what may have moved since the snapshot's versions (resolutions once the file set moved, raw facts once their version did), and accepts synchronously in the caller's turn (`accept`): both versions unmoved since the check began, the route-registry digests read again, and the entry judged still the one. A version that moved during the check makes it check again: the facts version too (p1), not only the file set. A failed hit is counted (`staleHits` / `lazyHits`) from that one check, not a second validation (C6-13). `PlanCache.delete` moves the key's generation: every eviction (a failed hit, an invalidation, a registry change, an own-file event of another text) without a bump at each caller. An own-file event no longer sets the key's latest text from the file's raw text (C6-03): it evicts a plan of another text, and moves the generation when the latest request's text differs, so a compile of a plugin-transformed text attempts again and publishes. A latest untouched settlement retires a restored plan's dependencies too (C6-09). Rows (`router-utils/tests/freshness.test.ts`): the four step-0 pins (C6-01 hit and restore, C6-03, the registry digest during a hit) are green; new "a change of what the restored plan read stales nothing" (C6-09, red before). The p1 rows stay green with the `asked` bump off; the comment-only pin stays for step 6b. Settlement design rev 4, step 6a. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n rule, one answer per fact - A snapshot check acts on its verdict in the turn it is reached (`checkSnapshot`'s judge: `still`, `accept`, `refuse`): a failed hit's eviction can no longer remove a newer text's plan published meanwhile. A plan hit takes one round: one that overlapped an event compiles (its attempt's `stable` is the check), so a storm no longer loops hit checks. - Evicting a plan of the key's latest text moves the generation; a plan of an older text or a restored one has no current answer, and an event of the latest request's text moves nothing (no second attempt, an open answer of that text stays current). - An event of another text than the latest request's, or of one the compiler cannot compare (a module compiled in place), moves the generation and stales the file until a request settles the event's text; only a removal clears the latest text (`PlanCache.removed`). - An attempt reads one answer of each fact (resolution, raw facts, target facts, marker), however many reads ask it: two reads of a dependency saved and saved back no longer reach the plan as two texts. - A virtual module's miss is kept in the raw-facts cache, so `expireVirtual` and its change event find it. Rows in `freshness.test.ts` for each (red on def30553f5 or, for the one-answer row, with the `asked` restart off), plus the C6-09 control. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…stable again; virtual marker misses - A plan hit checks with `stable` again (the round that refuses in its own turn), not one round falling to a compile: a compile of the hit's text replaced its plan with no eviction, so an open answer of the old plan stayed current and the file was not stale. `checkSnapshot` is `stable`'s private round. - `RawFactsCache.marker` keeps a virtual module's miss (a markerless entry), as `get` does: `expireVirtual` and the module's change event find it. - `supersede`'s `kept`: the restored-plan test was dead (a published and a restored plan are never both held). - KNOWN-BUGS: a restore checked while a request runs and ends, two persisted snapshots of one key, and `TSR_COMPILER_NO_CACHE=plans` replacing a same-text plan without eviction. Rows (`freshness.test.ts`): the hit whose resolution moves during its check (open answer, stale set; a request joining its compile), the virtual marker miss (expiry; change event in flight), a file removed and created again with the same bytes, one specifier from two importers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…evidence; config-mid-check rows dropped - A virtual module's load that throws is read as missing for that read only: no raw-facts entry is kept (`get`, `marker`), so it is read again at the next ask after a facts move, as before step 6a. Only the host's clean `null` is a miss the cache keeps. Start's Vite host passes the rejection through (no `.catch(() => null)`). Without it, a server-only virtual module whose first load failed stayed markerless for the dev session: its importer's client edge was never denied. - A config change during a compile or a check is not a case the core handles: the C6-01 rows (a tsconfig edit while a hit, an attempt or a restore waits on the resolver) are deleted. "A plan hit whose resolution moves during its check" now moves the resolution by a file creation the plan's rows do not watch (an alias target elsewhere). - KNOWN-BUGS: a text requested again while its first compile runs (A, B, A) is compiled twice at one generation (on a37f460 too). Row: "a load that threw is read again: the next request after a save sees the marker" (the compile rejected on 702aea2eae, whose hosts caught the throw into the kept miss). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A virtual module's load that threw now keeps its raw-facts entry with no
facts instead of none: every read still loads it again (it is never
served as a fact), and `expireVirtual` and the module's change event find
it, as they find any other virtual entry. Before, a watch rebuild after a
thrown load that then recovered served the importer's plan with no
marker.
Rows: "a watch rebuild after a load that threw and then recovers sees the
marker" (red on 87da2c9a91); the C6-01 attempt and restore rows written
again with the file-creation trigger ("a compile whose resolution moves
during its check answers the new target", "a restored plan whose
resolution moves during its check is reported stale"), the only rows
reaching a refused attempt and a refused restore.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dependents index holds only the published (and restored) plans' rows; a compile in flight has none. Its snapshot check (`stable`) asks again what an event moved (the file set, the raw facts) and refuses or accepts in its own turn, so nothing restarts it from outside. Deleted: `DependentEntry.asked`, `DependentsIndex.ask`, `drop(…, 'asked')` and the two-fact rows (a row is a key now), the ledger's incremental rows (`indexPath`, `indexKeys`, `publish`: `PlanCache.set` publishes a plan's rows from its dependencies, as `restore` does), the `revalidate` bump and `PlanCache.bump`. What the `asked` rows also told: - An event that reads a file empty waited for its text when a compile in flight had read it. Now the reader waits: an empty read of a file whose last event read it empty is no evidence (`RawFactsCache.maySave`, the in-place-save wait `readSaved` already had for a file that held a module), so any compile reading it after the event, superseded or not, reads the saved text. A code file's only (an asset reads as '' and never waits), and once per event (an event that waited in vain, `emptyAt`, confirms the file is empty). - `RawFactsCache.marker` keeps its entry with the target-facts knob off, as `get` does, so a virtual module's change event finds it. Rows (`freshness.test.ts`): "a comment-only edit: the compile is not attempted again" un-pinned (KNOWN-BUGS entry removed); new "a load that threw, announced during the importer's compile, reaches the importer", "a virtual module's exports read when its load threw" (the `get` half), and "a dependency truncated and written while a compile that resolved it runs" (Astra's watcher sequences: the compile's own text, and an older text superseded meanwhile), and "an empty read after a file's event" (an asset schedules no wait; an empty code file is read once per event). Settlement design rev 4, step 6b. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hat were measured Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… record follows the output on disk; one resolverManifest The client-build record has one setter (`ClientBuilds.setClientBuild`), called in one of Start's `enforce: 'pre'` plugins: none at a written build's `renderStart` (`order: 'pre'`: Vite empties the output directory in that phase), the written output at `writeBundle` (`order: 'pre'`, from the bundle `writeBundle` gets: after every plugin's `generateBundle`), an in-memory build's (`!isWrite && build.write === false`, never an RSC run's plugin-rsc scans) at `generateBundle` (`order: 'post'`). Every call ends in `followClientBuild` (the sentinel). Production builds only. The record holds the referenced functions' descriptors and the callable ids; the SSR provider's resolver lists the record's descriptors (the server environment's own declaration where it has one), not the live registry joined with ids. RSC: the provider list follows the provider's output the same way (withdrawn at its `renderStart`, committed at its `writeBundle` from what its resolver listed); `callableNotProvided` reads the record's descriptors. One `resolverManifest(entries, shape)` decides what a resolver lists and how it gates, for Vite and Rsbuild (S1-14, S5-07): `client-gated`, `provider-first`, `provider-gated`, `dev`. Deleted: `publishClientBuild` and its early write at `generateBundle`, `NOTHING_CALLABLE` and the bundled dev client's record (S4-08), Vite's half of `session.published` (the session's `clientCallable` is pure; Rsbuild's `publishClientOutput` keeps its publication: S3-20), `providerListed` set in the resolver's `load` (S4-27), `productionResolverModule`, `providedEntries` and the `clientReferencedOnly` option; KNOWN-BUGS "a client rebuild whose output fails keeps the previous client build" (fixed). Rows: un-pinned `start-build-settlement-output` "another plugin's generateBundle fails" and `start-build-settlement-ids` "S4-02"; new `start-build-settlement-record.test.ts` (Start's own output-phase failure, a denied import under `behavior: 'error'`, with recovery; Astra's stylesheet renamed by a later plugin; `write: false` in watch mode) and `tests/vite-client-build-record.test.ts` (when the setter runs, the in-memory build included). Settlement design rev 4, step 7 (the decided trigger). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es no client file; the provider list from module meta - With no client-build record the production manifest names no client file (no dev entry); the settlement helper checks every client URL the document names. - A written client build with two entries fails at generateBundle, before anything is written, as before step 7. - The separate provider's list comes from the resolver module's meta, read when the provider's output is written (or generated, for a build that writes nothing): no held value across builds. - One rule for builds that write nothing (write: false without watch, watch.skipWrite): the in-memory path. - Dropped the RSC-scan guard and ClientBuilds.rsc; resolverManifest takes two arguments, the dev shape one boolean; writtenBuild sits next to the record. - KNOWN-BUGS: the record's limits, the two measured costs, a deleted server-fn file with a client build failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…te and build.write on has no client build Vite empties the output directory at renderStart whenever build.write is on, skipWrite included, and such a build writes nothing: the record (and a separate provider's list) is withdrawn and nothing commits it. One function, outputOnDisk (written, emptied, unchanged), replaces writtenBuild; only a build that leaves the directory unchanged (build.write: false) takes the in-memory path. KNOWN-BUGS limit 5 corrected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ctory call
when-does-this-run rule 2 (DECISIONS 2026-11-26): the hoist of an inline
component call (`memo(…)`, `withAuth(Page)`) no longer proves that nothing
the route statement evaluates before it runs code. `onlyInertBefore` and
`isInert` are deleted; `refreshRegisters` stays (what React Refresh
registers, not timing).
One guard: a call is not hoisted past an earlier declarator of its own
declaration (`export const Helper = Page, Route = …({ component:
memo(Helper) })`), where the hoist read `Helper` before its initialisation
(ReferenceError at load, also on bded194).
Rows: the earlier-declarator case loads and renders (unsplit and
`codeSplitGroupings: []`); `memo(…)` after options that call functions
keeps its state across an edit. Deleted: the S2 rows asserting the
refusals (an earlier option's call runs first; `memo` kept inline after a
call). KNOWN-BUGS: the reorder, both directions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, in every module when-does-this-run rule 1, B (DECISIONS 2026-11-26, "dynamic marker imports"): a dynamic `import()`/`require()` of `server-only` or `client-only` never marks its module, so the three-function-type ancestor check in ModuleAnalysis is deleted. The import-edges planner judges a marker edge in any module without a static marker, not only in entries, wherever the module's output keeps the edge. A server fn handler's import is erased from the client output and is not judged there. This closes bded194's silent case: a marker imported in a function the client keeps was neither marked nor reported, and the module shipped. In the `error` behavior the build now fails at the marker import, as on main. Under `mock`, only that import is mocked and the rest of the module ships, as on main with Vite. KNOWN-BUGS, SPEC J6.1 and the import-protection guide say so, with the advice that a static marker import protects the whole file. markerConflict reads static markers only, the only ones that mark. Rows (build-markers, Vite and Rsbuild): a dynamic marker at the top level, in a function the client keeps, a class field, a static block, a computed class key or a TypeScript namespace fails the build at the marker import; one in a server fn handler leaves the module to the client; in mock mode the import is mocked alone and reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mport User decision 11-26, replacing B: dynamic marker imports are not supported when they add any complexity. A marker is a static import or re-export; a dynamic `import()` or `require()` of one is an ordinary import: it marks nothing and gets no marker judgement of its own. Deleted from 7a7adca: the marker-edge judgement widened to modules without a static marker (`edges.ts` is bded194's again but for `markerConflict`, which reads static markers only, the only ones that mark); its KNOWN-BUGS mock limit and guide paragraph; the dynamic-marker rows of build-markers (the positions, the handler body, the mock row). The ModuleAnalysis marker branch of the dynamic-edge loop stays deleted. Also deleted: the builder-shapes refusal "a marker as a dynamic import", which asserted that a top-level dynamic marker marks its module. Guide, SPEC J6.1 and a KNOWN-BUGS accepted limit say it: a marker is a static import; a dynamic one is an ordinary import and is not checked (a client entry's own marker import is still judged at its import whatever its form, as on bded194). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ildren in place with one warning
Children the split would hand a copy of a binding instead of the binding are not extracted: children assigning a
captured local, on React a function of the children reading a local the component reassigns (no proof of when the
writes run), a capture declared after the boundary (D-27), a Solid ref in a nested boundary naming a local outside
both, children or code only they use assigning a module binding (the core's shared-writer fallback). The boundary
renders in place as with split={false}, keeps its id in every env (the server is unchanged, D-25), and the client
compile warns once (`hydrate-not-split`). Text-only children are never extracted, in any spelling (D-26).
Deleted: writesComplete, WRITE_CONTAINERS, moduleWriteMessage and the refusals hydrate-capture-reassigned,
hydrate-capture-write, hydrate-nested-ref, hydrate-module-write, with their rows; SPEC J5.5 rewritten; docs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…27 rule and the two-chunk module write - D-27 is one rule: a capture whose runtime declaration (the declaration table's value rows, by the symbol's binding) does not end before the boundary starts keeps the children in place, a hoisted function excepted. Covers a type of the same name before a later const, a local holding the boundary in its own initialiser (const, object, array pattern, var) and a Solid directive. - Placement: an output assigning its copy of a binding another output holds unwritten falls back whatever the binding's home (a module let only two Hydrate chunks use, one assigning it, was two silent copies); the removed home still means nothing to import. - Wording: main splits a capture whose declaration ends after the boundary and may read it early (not "throws"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ary is no longer a limit (D-27 keeps it in place) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… not another case's on the shared channel Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.29.0, which has every fix. yuku-toolchain/yuku#290 was closed because its fix is deferred to Yuku's upcoming transformer; we don't need it.
All 28 Yuku issues
_/$/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)build --watch:closeBundledoes not run when an output hook fails vitejs/vite#24219build --watchruns nocloseBundlewhen an output hook (renderStart…writeBundle) fails; Start's client-build record does not depend on itvite: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 } }))closeBundleruns twice after a build-phase error rolldown/rolldown#11969 watch mode:closeBundleruns twice after a build-phase error (theERRORevent's result closes an already closed bundle)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)n!: -1n), aborting the process (Vite 8)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