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
tanstack: vendor-router chunk swallows the whole app (manualChunks captures the client entry; global sync sections; preview code in prod bundle) #662
On a TanStack site built with @decocms/tanstack 7.77.2 (deco-sites/oficina-tanstack), every page ships one client chunk called vendor-router of 2.32 MB raw / 758 KB gzip, while main-*.js is 237 bytes. Only ~98 KB of it is router code; the rest is the whole app.
src/vite/plugin.jsmanualChunks (~l.875-903) sends @tanstack/react-start-client, @tanstack/start-client-core and the @tanstack/start catch-all to vendor-router. That includes the client entry (StartClient), and Rollup treats a manual chunk as a pseudo-entry: every module reachable only through it (router → routeTree → cmsRoute → .deco/sections.gen.ts → every sync = true section and its components) is assigned to the same chunk.
sync = true sections are registered globally in .deco/sections.gen.ts (import * as _syncN), so a section used on a single page (e.g. My Account, 288 KB of components) lands on every page.
Admin/preview-only code reaches the production client bundle: @decocms/blocks/src/preview/decoMark.ts, cms/schema.ts, cms/resolve.ts, and the site's previews/* (export { Preview } from each section).
Measured on the site: removing sync from 23 single-page sections drops the chunk by 54 KB gzip (−7 %) on every page; the structural fix belongs in the plugin.
Proposal
manualChunks should not capture the client entry/start-client-core; keep vendor-router to router packages only.
Register sync sections per page/route (or let the generator emit per-page chunks) instead of one global eager import.
Strip preview/admin modules (decoMark, schema, Preview exports) from production client builds.
Found while validating deco-sites/oficina-tanstack#479 (QA-165).
Activity