TanStack / TanStack/router

TanStack Router adds 29KB instead of 12KB to the bundle

Open
#7,090 4 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.1k
Forks
1.9k
Avg merge
1d 20h
Merged PRs (30d)
143

Description

Which project does this relate to?

Router

Describe the bug

I created a Vite + SolidJS + TanStack Router app and was expecting 12KB for an almost empty web app but it added 29KB to it. Is this a bug or did the TanStack Router bundle increase by more than 100% over the last months? If that is the cases it is probably no longer "Lightweight".

Website:

Image

Vite + SolidJS:

 vite v8.0.3 building client environment for production...
✓ 12 modules transformed.
computing gzip size...
dist/index.html                  0.46 kB │ gzip: 0.29 kB
dist/assets/vite-BF8QNONU.svg    8.70 kB │ gzip: 1.60 kB
dist/assets/hero-5sT3BiRD.png   44.91 kB
dist/assets/index-DykytF2W.css   4.10 kB │ gzip: 1.47 kB
dist/assets/index-DbBVHp2z.js   16.04 kB │ gzip: 6.09 kB

✓ built in 580ms

Vite + SolidJS + TanStack Router:

vite v8.0.3 building client environment for production...
✓ 92 modules transformed.
computing gzip size...
dist/index.html                   0.45 kB │ gzip:  0.28 kB
dist/assets/index-9lpGihRV.css   11.90 kB │ gzip:  3.27 kB
dist/assets/about-CPZOf6_P.js     0.59 kB │ gzip:  0.40 kB
dist/assets/routes-CZaK90oP.js    2.83 kB │ gzip:  1.37 kB
dist/assets/index-Ds7sFwGP.js   107.91 kB │ gzip: 35.35 kB

✓ built in 542ms
Your Example Website or App

https://stackblitz.com/edit/vitejs-vite-wgefec7z

Steps to Reproduce the Bug or Issue
  1. Use the StackBlitz link or npx @tanstack/cli create --router-only --framework solid
  2. npm run build
Expected behavior

It should only add 12KB to the final bundle

Screenshots or Videos

No response

Platform
  • Router Version: 1.168.9
  • OS: macOS
  • Bundler: Vite
  • Bundler Version: 8.0.1
Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked StackBlitz reproduction or create the router-only Solid app using the provided npx command, then run npm run build and compare the generated bundle sizes. Trace why the Router build produces the reported output instead of the expected 12KB, and confirm the fix by reproducing the build with the bundle reduced to the expected size.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vite
Domain
build-system, frontend, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.