Skip to content
Source
Sign inSign up
TanStack/router

fix(start-plugin-core): Rsbuild manifests list only a route's own chunks #8876

OpenSheraff(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromstart-plugin-core/rsbuild-manifest-own-chunksopened

The bug

On Rsbuild, Start's client manifest gave a route the chunks and CSS of a sibling route.

computeStaticDependencyChunks (packages/start-plugin-core/src/rsbuild/normalized-client-build.ts) counted a chunk as available to a chunk when any one of that chunk's groups (or their ancestors) had it. Take two split routes, /alpha and /beta. Both import shared.js, which has a chunk of its own, and shared.js imports widget.js, which Rspack duplicates into each route's chunk. Then the shared chunk "depends on" both alpha.js and beta.js, and each route's manifest entry pulls in the other route's chunk.

Main's manifest for that app:

"/alpha": { "css": ["/beta.css", "/alpha.css"], "preloads": ["/alpha.js", "/shared.js", "/beta.js"] }
"/beta":  { "css": ["/alpha.css", "/beta.css"], "preloads": ["/beta.js", "/shared.js", "/alpha.js"] }

So /alpha's page preloads /beta.js and links /beta.css, ahead of its own stylesheet: the other route's styles apply on this page, and an extra chunk is downloaded.

The fix (from #8817)

A chunk counts as available only when every group of the shared chunk (or one of that group's ancestors) has it. A module duplicated into each route's chunk is satisfied in each group by that group's own copy, so neither route's chunk is a dependency of the shared chunk. With the fix:

"/alpha": { "css": ["/alpha.css"], "preloads": ["/alpha.js", "/shared.js"] }
"/beta":  { "css": ["/beta.css"],  "preloads": ["/beta.js", "/shared.js"] }

This is #8817's hunk, unchanged: after this PR, the file is identical to #8817's. #8817 and #8780 also address this bug.

Test

tests/rsbuild/normalized-client-build.test.ts: "does not import a sibling route chunk through a module duplicated into each route". It builds the app above with Rspack and checks the manifest entries of both routes. It fails on main (shared.js imports ['alpha.js', 'beta.js']; /alpha's CSS is ['/beta.css', '/alpha.css']) and passes with the fix.

This is #8817's own test, copied verbatim into main's existing file at the same place. It runs on main's fixture helpers, so it stays the single long-term home: when #8817 merges main, the two copies merge into one.

Validation

  • pnpm format.
  • @tanstack/start-plugin-core: test:unit (876 passed, 1 expected fail), test:integration, test:types, test:eslint, test:build.
  • React Start Rsbuild e2e: basic (rsbuild-ssr, -ssr--iife, -spa, -spa--dev, -prerender, -preview), css-modules, css-inline (rsbuild-ssr, --transform-assets), deferred-hydration, rsbuild. All pass.
  • Bundle size: react-start.rsbuild.minimal, minimal-iife and full are byte-identical to main, hashes included (gzip 102763 / 103184 / 106020). These apps have no module shared between two routes in a chunk of its own, so their manifests don't change.

Merging with #8817

I merged this branch into main, then merged #8817's head (eb1a7841bb) on top. There are no new conflicts: the same 26 files conflict as for main + #8817 alone. normalized-client-build.ts and its test merge to exactly #8817's content, and the test appears only once.

Afterwards, #8817 drops:

  • the bullet in .changeset/start-compiler-yuku.md: "the client manifest lists only the chunks a route loads (#8780)";
  • the description line "manifests list only a route's own chunks".

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Route client manifests now list only each route’s own CSS and chunks, rather than including assets from sibling routes that share a dependency.
    • Shared chunks remain available to routes that need them, reducing unnecessary stylesheet and chunk preloads.
    1. 🦋 Changeset detected

      Latest commit: 6df3b5d04e60804efb937967916b351b4842349b

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

      This PR includes changesets to release 5 packages
      NameType
      @tanstack/start-plugin-corePatch
      @tanstack/react-start-rscPatch
      @tanstack/react-startPatch
      @tanstack/solid-startPatch
      @tanstack/vue-startPatch

      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

    2. nx-cloud[bot](GitHub profile, opens in a new tab)commented

      View your CI Pipeline Execution ↗ for commit 6df3b5d04e60804efb937967916b351b4842349b

      CommandStatusDurationResult
      nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded16m 29sView ↗
      nx run-many --target=build --exclude=examples/*...✅ Succeeded19sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-11-04 20:12:45 UTC

    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      The Rsbuild static dependency calculation now intersects chunks available through each relevant chunk group and its ancestors. A regression test checks that routes sharing a chunk retain their own stylesheet and preload entries.

      Changes: Rsbuild route client manifest

      Layer / File(s)Summary
      Chunk availability and route manifest regression
      packages/start-plugin-core/src/rsbuild/normalized-client-build.ts, packages/start-plugin-core/tests/rsbuild/normalized-client-build.test.ts, .changeset/rsbuild-manifest-own-chunks.md
      The calculation now intersects available chunks across relevant groups and ancestors. The regression test checks route-specific stylesheets and preloads when two routes share a chunk. The changeset describes the manifest behavior.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix

      Possibly related issues

      • TanStack/router#8810: The issue describes sibling routes receiving each other’s CSS and preload entries when they share a chunk. The PR changes the Rsbuild chunk-availability calculation for this behavior.

      Possibly related PRs

      • TanStack/router#8780: This PR addresses the same Rsbuild route-manifest behavior by changing computeStaticDependencyChunks.

      Suggested labels: package: start-plugin-core

      Suggested reviewers: ladybluenotes

      Merge Risk: Low · up to 6df3b

      An asymmetric chunk split can leave a route’s stylesheet and preload out of its manifest. The impact on client loading remains unverified.

      Pre-merge checks: Passed 5
      Check nameStatusExplanation
      Title checkPassedThe title clearly and concisely identifies the main change: Rsbuild manifests now list only a route's own chunks.
      Description checkPassedThe description is detailed and relevant. It explains the bug, fix, regression test, validation results, release context, and AI authorship. It does not reproduce the template's explicit checklist or …
      Docstring CoveragePassedDocstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Full details: Description check

      Explanation

      The description is detailed and relevant. It explains the bug, fix, regression test, validation results, release context, and AI authorship. It does not reproduce the template's explicit checklist or release-impact headings, but the required information is mostly present.

      Full details: Docstring Coverage

      Explanation

      Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files. (1 skipped: 1 unsupported.)

      Finishing Touches
      Generate docstrings
      • Commit to this branch
      • Create a new PR
      Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

      Share
      Recent review info
      Run configuration
      Commits

      Reviewing files that changed from the base of the PR and between c5320d7ca23eca82d720ac5629d2bad5cf7d9b02 and 6df3b5d04e60804efb937967916b351b4842349b.

      Files selected for processing: 3
      • .changeset/rsbuild-manifest-own-chunks.md
      • packages/start-plugin-core/src/rsbuild/normalized-client-build.ts
      • packages/start-plugin-core/tests/rsbuild/normalized-client-build.test.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

    4. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-plugin-core

    5. Bundle Size Benchmarks

      This pull request does not affect bundle size in any measured scenario.

    6. More templates

      @tanstack/arktype-adapter

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

      @tanstack/eslint-plugin-router

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

      @tanstack/eslint-plugin-start

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

      @tanstack/history

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

      @tanstack/react-router

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

      @tanstack/react-router-devtools

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

      @tanstack/react-router-ssr-query

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

      @tanstack/react-start

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

      @tanstack/react-start-client

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

      @tanstack/react-start-rsc

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

      @tanstack/react-start-server

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

      @tanstack/router-cli

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

      @tanstack/router-core

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

      @tanstack/router-devtools

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

      @tanstack/router-devtools-core

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

      @tanstack/router-generator

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

      @tanstack/router-plugin

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

      @tanstack/router-ssr-query-core

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

      @tanstack/router-utils

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

      @tanstack/router-vite-plugin

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

      @tanstack/solid-router

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

      @tanstack/solid-router-devtools

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

      @tanstack/solid-router-ssr-query

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

      @tanstack/solid-start

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

      @tanstack/solid-start-client

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

      @tanstack/solid-start-server

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

      @tanstack/start-client-core

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

      @tanstack/start-fn-stubs

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

      @tanstack/start-plugin-core

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

      @tanstack/start-server-core

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

      @tanstack/start-static-server-functions

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

      @tanstack/start-storage-context

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

      @tanstack/valibot-adapter

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

      @tanstack/virtual-file-routes

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

      @tanstack/vue-router

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

      @tanstack/vue-router-devtools

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

      @tanstack/vue-router-ssr-query

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

      @tanstack/vue-start

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

      @tanstack/vue-start-client

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

      @tanstack/vue-start-server

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

      @tanstack/zod-adapter

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

      commit: 6df3b5d

    7. 🚀 Changeset Version Preview

      9 package(s) bumped directly, 2 bumped as dependents.

      🟨 Minor bumps

      PackageVersionReason
      @tanstack/router-cli1.167.46 → 1.168.0Changeset
      @tanstack/router-generator1.167.46 → 1.168.0Changeset
      @tanstack/router-plugin1.168.48 → 1.169.0Changeset
      @tanstack/router-utils1.162.4 → 1.163.0Changeset

      🟩 Patch bumps

      PackageVersionReason
      @tanstack/react-start1.169.4 → 1.169.5Changeset
      @tanstack/react-start-client1.168.44 → 1.168.45Changeset
      @tanstack/solid-start1.169.4 → 1.169.5Changeset
      @tanstack/start-plugin-core1.171.55 → 1.171.56Changeset
      @tanstack/vue-start1.169.4 → 1.169.5Changeset
      @tanstack/react-start-rsc0.1.65 → 0.1.66Dependent
      @tanstack/router-vite-plugin1.167.48 → 1.167.49Dependent
    8. Merging this PR will degrade performance by 4.9%

      2 warnings

      :warning: 58 benchmarks are dominated by system calls

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

      Learn more about system calls

      See affected benchmarks

      :warning: 2 benchmarks with a significant change ran on different hardware

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

      Learn more about Macro Runners

      See affected benchmarks

      ❌ 2 regressed benchmarks ✅ 192 untouched benchmarks ⏩ 3 skipped benchmarks1

      Warning

      Please fix the performance issues or acknowledge them on CodSpeed.

      Performance Changes

      ModeBenchmarkBASEHEADEfficiency
      ❌Memorymem client unique-location-churn (vue)80.2 KB84.6 KB-5.21%
      ❌Memorymem server error-paths redirect (solid)10.7 KB11.2 KB-4.59%

      Tip

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


      Comparing start-plugin-core/rsbuild-manifest-own-chunks (6df3b5d) with main (c5320d7) Open in CodSpeed

      Footnotes

      1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Sign in to join this conversation.