fix(vue-start): pre-bundle @tanstack/vue-store so a cold dev start doesn't reload the page #8869
main fromrefs/pull/8869/head·merged 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'sstart-app.tsdoesn't drive a browser;- the
e2e/vue-startapps 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:
| run | main | this PR |
|---|---|---|
| Vite log | dependencies 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 loads | 2, 1, 2 | 1, 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:buildpasses (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.
optimizeDepsapplies 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-storefor the optimizer, … so a cold start no longer reloads the page once.", and the'@tanstack/vue-start': patchline, 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
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: vue-start
No actionable comments were generated in the recent review.
Walkthrough
-
Vue Start now includes
@tanstack/vue-router > @tanstack/vue-storein 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.mdVite includes @tanstack/vue-router > @tanstack/vue-storein 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 to1ec10-
No merge-blocking defect was identified in this dependency optimization change.
Pre-merge checks:
5-
Check name Status Explanation Title check The title names the fix (pre-bundling @tanstack/vue-storein 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 check 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 disc… Docstring Coverage 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. Documentat… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check 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-storein 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>@tanstack/vue-storeto 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.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: TanStack/router
- Branch: vue-start/prebundle-vue-store
- File: .coderabbit.yaml
- Commit: 1ec10c7
- Layers: Repository YAML
- Review profile: CHILL
- Plan: Advanced
- Run ID:
67995dc9-5e32-43b0-8746-46ae1925d5b8
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.mdpackages/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.
-
-
View your CI Pipeline Execution ↗ for commit 1ec10c7adcdc274285df67271d7ce21532bd24ca
Command Status Duration Result nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded 3m 57s View ↗
☁️ Nx Cloud last updated this comment at
2026-11-04 11:44:10UTC🚀 Changeset Version Preview#
9 package(s) bumped directly, 2 bumped as dependents.
🟨 Minor bumps#
Package Version Reason @tanstack/router-cli1.167.46 → 1.168.0 Changeset @tanstack/router-generator1.167.46 → 1.168.0 Changeset @tanstack/router-plugin1.168.48 → 1.169.0 Changeset @tanstack/router-utils1.162.4 → 1.163.0 Changeset 🟩 Patch bumps#
Package Version Reason @tanstack/react-start1.169.4 → 1.169.5 Changeset @tanstack/react-start-client1.168.44 → 1.168.45 Changeset @tanstack/solid-start1.169.4 → 1.169.5 Changeset @tanstack/start-plugin-core1.171.55 → 1.171.56 Changeset @tanstack/vue-start1.169.4 → 1.169.5 Changeset @tanstack/react-start-rsc0.1.65 → 0.1.66 Dependent @tanstack/router-vite-plugin1.167.48 → 1.167.49 Dependent More templates
- tanstack-router-solid-example-authenticated-routes
- tanstack-router-solid-example-authenticated-routes-firebase
- tanstack-router-solid-example-basic
- tanstack-router-solid-example-basic-default-search-params
- tanstack-router-solid-example-basic-devtools-panel
- tanstack-router-solid-example-basic-file-based
- tanstack-router-solid-example-basic-non-nested-devtools
- tanstack-router-solid-example-basic-solid-query
- tanstack-router-solid-example-basic-solid-query-file-based
- tanstack-router-solid-example-basic-ssr-file-based
- tanstack-router-solid-example-basic-ssr-streaming-file-based
- tanstack-router-solid-example-basic-virtual-file-based
- tanstack-router-solid-example-basic-virtual-inside-file-based
- tanstack-router-solid-example-deferred-data
- tanstack-router-solid-i18n-paraglide
- tanstack-router-solid-example-kitchen-sink
- tanstack-router-solid-example-kitchen-sink-file-based
- tanstack-router-solid-example-kitchen-sink-solid-query
- tanstack-router-solid-example-kitchen-sink-solid-query-file-based
- tanstack-router-solid-example-large-file-based
- tanstack-router-solid-example-location-masking
- tanstack-router-solid-example-navigation-blocking
- tanstack-router-solid-example-quickstart
- tanstack-router-solid-example-quickstart-esbuild-file-based
- tanstack-router-solid-example-quickstart-file-based
- tanstack-router-solid-example-quickstart-rspack-file-based
- tanstack-router-solid-example-quickstart-webpack-file-based
- @tanstack/router-solid-mono-simple
- router-solid-mono-simple-lazy
- router-solid-monorepo-solid-query
- tanstack-router-solid-example-scroll-restoration
- tanstack-solid-router-search-validator-adapters
- tanstack-solid-start-example-basic
- tanstack-solid-start-example-basic-auth
- tanstack-solid-start-example-basic-authjs
- tanstack-solid-start-example-basic-cloudflare
- tanstack-solid-start-example-basic-netlify
- tanstack-solid-start-example-basic-nitro
- tanstack-start-example-basic-solid-query
- tanstack-solid-start-example-basic-static
- tanstack-solid-start-bun-hosting
- tanstack-solid-start-example-convex-better-auth
- tanstack-solid-start-example-counter
- tanstack-solid-start-i18n-paraglide
- tanstack-solid-start-example-large
- tanstack-solid-start-streaming-data-from-server-functions
- tanstack-solid-start-example-supabase-basic
- tanstack-solid-start-tailwind-v4
- tanstack-router-solid-example-view-transitions
- tanstack-router-solid-example-with-framer-motion
- tanstack-router-solid-example-with-trpc
- tanstack-router-react-example-authenticated-routes
- tanstack-router-react-example-authenticated-routes-firebase
- tanstack-router-react-example-basic
- tanstack-router-react-example-basic-default-search-params
- tanstack-router-react-example-basic-devtools-panel
- tanstack-router-react-example-basic-file-based
- tanstack-router-react-example-basic-non-nested-devtools
- tanstack-router-react-example-react-query
- tanstack-router-react-example-basic-react-query-file-based
- tanstack-router-react-example-basic-ssr-file-based
- tanstack-router-react-example-basic-ssr-streaming-file-based
- tanstack-router-react-example-basic-virtual-file-based
- tanstack-router-react-example-basic-virtual-inside-file-based
- tanstack-router-react-example-deferred-data
- tanstack-router-i18n-paraglide
- tanstack-router-react-example-kitchen-sink
- tanstack-router-react-example-kitchen-sink-file-based
- tanstack-router-react-example-kitchen-sink-react-query
- tanstack-router-react-example-kitchen-sink-react-query-file-based
- tanstack-router-react-example-large-file-based
- tanstack-router-react-example-location-masking
- tanstack-router-react-example-navigation-blocking
- tanstack-router-react-example-quickstart
- tanstack-router-react-example-quickstart-esbuild-file-based
- tanstack-router-react-example-quickstart-file-based
- tanstack-router-react-example-quickstart-rspack-file-based
- tanstack-router-react-example-quickstart-webpack-file-based
- router-monorepo-react-query
- router-mono-simple
- router-mono-simple-lazy
- tanstack-router-react-example-scroll-restoration
- tanstack-search-validator-adapters
- tanstack-start-example-bare
- tanstack-start-example-basic
- tanstack-start-example-basic-auth
- tanstack-router-react-example-basic-authjs
- tanstack-start-example-basic-cloudflare
- tanstack-start-example-basic-react-query
- tanstack-start-example-basic-rsbuild
- tanstack-start-example-basic-static
- tanstack-start-bun-hosting
- tanstack-start-example-clerk-basic
- tanstack-start-example-convex-trellaux
- tanstack-start-example-counter
- tanstack-start-i18n-paraglide
- tanstack-start-example-large
- tanstack-start-example-material-ui
- tanstack-start-example-next-migration
- tanstack-start-example-rscs
- tanstack-start-streaming-data-from-server-functions
- tanstack-start-example-supabase-basic
- tanstack-start-tailwind-v4
- tanstack-start-example-trellaux
- tanstack-start-example-workos
- tanstack-router-react-example-view-transitions
- tanstack-router-react-example-with-framer-motion
- tanstack-router-react-example-with-trpc
- tanstack-router-react-example-with-trpc-react-query
- tanstack-router-vue-example-basic-jsx
- tanstack-router-vue-example-basic-file-based-jsx
- tanstack-router-vue-example-basic-file-based-sfc
@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@8869commit:
1ec10c7Bundle Size Benchmarks#
This pull request does not affect bundle size in any measured scenario.
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.
: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.
⚡ 2improved benchmarks✅ 192untouched benchmarks⏩ 3skipped benchmarks1Performance Changes#
Mode Benchmark BASEHEADEfficiency ⚡ Memory mem client unique-location-churn (react)79.3 KB 76.5 KB +3.7% ⚡ Memory mem client navigation-churn (solid)108.5 KB 104.9 KB +3.46% Tip
Curious why performance improved? Comment
@codspeedbot explain why performance improvedon this PR, or directly use the CodSpeed MCP with your agent.
Comparingvue-start/prebundle-vue-store(1ec10c7) withmain(1ba19a0)Footnotes#
-
3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
-
Sheraff(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
🦋 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
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