`ssr: false` routes still bundle components in server output
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?
Start
Describe the bug
When using Selective SSR with ssr: false on a route, the route's components are still included in the server bundle even though they'll never be server-rendered.
Example scenario:
/app/*routes marked withssr: falsei.e all CSR routes- These routes use a heavy client-side dependency (PlatejS editor, ~5MB)
- The editor ends up in both client and server bundles
Your Example Website or App
https://gitcms.waishanv.workers.dev/
Steps to Reproduce the Bug or Issue
- Create a TanStack Start project with a route that has
ssr: false - Import a heavy client-side dependency in that route (e.g., a rich text editor)
- Run the production build (
pnpm run build) - Inspect the server bundle output
- Notice the client-side dependency is included in the server bundle despite
ssr: false
Expected behavior
Expected: Since these routes will never SSR i.e Client Side Routes, their components shouldn't be bundled in the server output at all.
Current behavior: The ssr flag seems to only affect runtime behavior, not build-time tree-shaking.
Screenshots or Videos
No response
Platform
- Start Version: 1.150.0
- OS: Linux
- Browser: [e.g. Chrome, Safari, Firefox]
- Browser Version: Brave (chroimum - 144.0.7559.59)
- Bundler: vite: 7.1.7
- Bundler Version: [e.g. 7.0.0]
Additional context
Workaround: I'm currently stubbing out CSR-only route components in the server build via a Vite plugin (replacing them with () => null), which significantly reduces server bundle size.
Would it be feasible to make ssr: false a build-time signal/flag to exclude those route components from the server bundle?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the production build for a route configured with ssr: false and inspect how that route is represented in the server bundle. Compare the server output with the route's client-only behavior and verify that a heavy client-side dependency is no longer included in the server output while the client build still contains it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100