Skip to content
Source
Sign inSign up
TanStack/router

fix(vue-start): pre-bundle @tanstack/vue-store so a cold dev start doesn't reload the page #8869

MergedSheraff(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/8869/headmerged by Sheraff(GitHub profile, opens in a new tab)

What

Vue Start excludes @tanstack/vue-router from Vite's dependency optimization, so the scanner never sees the router's @tanstack/vue-store import. The first page load on a cold dependency cache discovers it late. It imports vue, so Vite re-chunks the already optimized vue, logs optimized dependencies changed. reloading, and reloads the page. That happens on every cold start.

The fix declares @tanstack/vue-router > @tanstack/vue-store in optimizeDeps.include, as React Start does for @tanstack/react-store. The change comes from #8817 (packages/vue-start/src/plugin/vite.ts). It's only the Vue half of #8817's cold-start fix. The other half, Start no longer pre-bundling @tanstack/<framework>-router/hmr, concerns a subpath that only exists in #8817.

Evidence (no automated test on main)

The behaviour depends on Vite's optimizer state: a cold node_modules/.vite, a real browser crawling the module graph, and a count of document loads. main has no harness for that:

  • start-plugin-core's start-app.ts doesn't drive a browser;
  • the e2e/vue-start apps run with whatever cache the previous run left, and their first test would carry the assertion, so it would depend on test order.

A unit test checking that the config contains the string would only restate the change. #8817 tests the behaviour in start-plugin-core/tests/integration/start-dev-cold-start.test.ts ("vue: the page hydrates in the document it first loaded"), on its own browser and dev-server harness. That stays the single test.

Manual check on e2e/vue-start/basic, with vite dev on an empty node_modules/.vite each time. A Playwright script opens / and counts load events until 8 s pass without one:

runmainthis PR
Vite logdependencies optimized: @tanstack/vue-store, cookie-es, seroval-plugins/web, then optimized dependencies changed. reloading (3/3)dependencies optimized: cookie-es, seroval-plugins/web, no reload (3/3)
page loads2, 1, 21, 1, 1

In the main run with a single load, the reload was announced before the page's HMR client connected. cookie-es and seroval-plugins/web are still discovered late, but they don't re-chunk anything, so no reload.

Validation

Run locally with Node 26.12.1, a frozen install, through Nx:

  • pnpm format;
  • vue-start: test:build passes (it's the package's only test target);
  • tanstack-vue-start-e2e-dev-ssr-styles:test:e2e (vite dev, normal and bundled dev) passes;
  • bundle size: not run. optimizeDeps applies only to the dev server.

Merging into #8817

Merging this branch into #8817's head adds no conflicts to the ones main already has: vue-start/src/plugin/vite.ts merges to #8817's exact text.

After that, #8817 should drop:

  • from .changeset/dev-cold-start-and-invalidate-index.md: the sentence "Vue Start declares @tanstack/vue-router > @tanstack/vue-store for the optimizer, … so a cold start no longer reloads the page once.", and the '@tanstack/vue-start': patch line, since nothing else in that changeset concerns vue-start;
  • from its description: "Vue Start dev no longer reloads after dependency optimization."

Its start-dev-cold-start.test.ts stays: it's the only test, and it also covers the /hmr half.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • On a cold dependency cache, the first page load no longer re-optimizes Vue dependencies and reloads the page. Vue Start now pre-bundles the relevant Vue Router and Vue Store dependencies when client-side optimization is enabled, or when server-side optimization is opted into. This makes the initial page load more stable in those configurations.
    1. 🦋 Changeset detected

      Latest commit: 1ec10c7adcdc274285df67271d7ce21532bd24ca

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

      This PR includes changesets to release 1 package
      NameType
      @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. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: vue-start

    3. Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      Vue Start now includes @tanstack/vue-router > @tanstack/vue-store in Vite dependency optimization for the client or an opted-in server environment. A patch changeset records the update and its stated effect on cold-cache first page loads.

      Changes: Vue Store Pre-bundling

      Layer / File(s)Summary
      Dependency optimization and release note
      packages/vue-start/src/plugin/vite.ts, .changeset/vue-start-prebundle-vue-store.md
      Vite includes @tanstack/vue-router > @tanstack/vue-store in dependency optimization under the existing environment condition. The changeset records a patch release and the stated cold-cache effect.

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

      Change: Bug fix

      Merge Risk: Minimal · up to 1ec10

      No merge-blocking defect was identified in this dependency optimization change.

      Pre-merge checks: Passed 5
      Check nameStatusExplanation
      Title checkPassedThe title names the fix (pre-bundling @tanstack/vue-store in vue-start) and the symptom it addresses (a cold dev start reloading the page). This matches the changeset and the code change, which adds @…
      Description checkPassedThe description follows the template structure. It has a detailed What section explaining the cause and fix, and it gives evidence through a manual before-and-after table and validation steps. It disc…
      Docstring CoveragePassedNo eligible functions found in the changed files. Skipping docstring coverage check. 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: Title check

      Explanation

      The title names the fix (pre-bundling @tanstack/vue-store in vue-start) and the symptom it addresses (a cold dev start reloading the page). This matches the changeset and the code change, which adds @tanstack/vue-router &gt; @tanstack/vue-store to optimizeDeps.include in packages/vue-start/src/plugin/vite.ts. The title is specific and relevant, though it is slightly long at 90 characters.

      Full details: Description check

      Explanation

      The description follows the template structure. It has a detailed What section explaining the cause and fix, and it gives evidence through a manual before-and-after table and validation steps. It discloses no AI authorship. It does state 'Generated with Claude Code' in the footer, which covers the AI-authorship disclosure rule. The Checklist and Release Impact sections are not filled in: no boxes are ticked, and it does not say whether a changeset was generated, although the raw summary shows a changeset was added. The description also does not explicitly tick the contributing guide or local testing items. These are minor gaps, and the core content is complete.

      Resolution

      Tick the checklist items the author has completed, including the contributing guide and local testing items. In Release Impact, tick the box for a published change with a generated changeset, since .changeset/vue-start-prebundle-vue-store.md is included in the PR.

      Full details: Docstring Coverage

      Explanation

      No eligible functions found in the changed files. Skipping docstring coverage check. 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 0 functions across 1 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 1ba19a04456983ee0f8adffd038b6b1194441e15 and 1ec10c7adcdc274285df67271d7ce21532bd24ca.

      Files selected for processing: 2
      • .changeset/vue-start-prebundle-vue-store.md
      • packages/vue-start/src/plugin/vite.ts

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

    4. View your CI Pipeline Execution ↗ for commit 1ec10c7adcdc274285df67271d7ce21532bd24ca

      CommandStatusDurationResult
      nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded3m 57sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-11-04 11:44:10 UTC

    5. 🚀 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
    6. More templates

      @tanstack/arktype-adapter

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

      @tanstack/eslint-plugin-router

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

      @tanstack/eslint-plugin-start

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

      @tanstack/history

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

      @tanstack/react-router

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

      @tanstack/react-router-devtools

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

      @tanstack/react-router-ssr-query

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

      @tanstack/react-start

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

      @tanstack/react-start-client

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

      @tanstack/react-start-rsc

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

      @tanstack/react-start-server

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

      @tanstack/router-cli

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

      @tanstack/router-core

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

      @tanstack/router-devtools

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

      @tanstack/router-devtools-core

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

      @tanstack/router-generator

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

      @tanstack/router-plugin

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

      @tanstack/router-ssr-query-core

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

      @tanstack/router-utils

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

      @tanstack/router-vite-plugin

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

      @tanstack/solid-router

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

      @tanstack/solid-router-devtools

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

      @tanstack/solid-router-ssr-query

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

      @tanstack/solid-start

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

      @tanstack/solid-start-client

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

      @tanstack/solid-start-server

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

      @tanstack/start-client-core

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

      @tanstack/start-fn-stubs

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

      @tanstack/start-plugin-core

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

      @tanstack/start-server-core

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

      @tanstack/start-static-server-functions

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

      @tanstack/start-storage-context

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

      @tanstack/valibot-adapter

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

      @tanstack/virtual-file-routes

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

      @tanstack/vue-router

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

      @tanstack/vue-router-devtools

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

      @tanstack/vue-router-ssr-query

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

      @tanstack/vue-start

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

      @tanstack/vue-start-client

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

      @tanstack/vue-start-server

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

      @tanstack/zod-adapter

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

      commit: 1ec10c7

    7. Bundle Size Benchmarks

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

    8. Merging this PR will improve performance by 3.58%

      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 improved benchmarks ✅ 192 untouched benchmarks ⏩ 3 skipped benchmarks1

      Performance Changes

      ModeBenchmarkBASEHEADEfficiency
      ⚡Memorymem client unique-location-churn (react)79.3 KB76.5 KB+3.7%
      ⚡Memorymem client navigation-churn (solid)108.5 KB104.9 KB+3.46%

      Tip

      Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


      Comparing vue-start/prebundle-vue-store (1ec10c7) with main (1ba19a0) 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.