You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ssr: false routes still bundle components in server output #6400
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 with ssr: false i.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
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?
Reacted by Bohdan Ptyts, Yassine, Bartosz Podgruszecki and Pofu
Activity
Exclude module page bodies from the server bundle