Describe the bug#
In large projects, the root route ends up with all route chunks in its modulepreload list, which is inherited by every SSR'd page. For a 150+ route app this means 80–150+ <link rel="modulepreload"> tags on every server-rendered HTML response.
Context / motivation#
I ran into this while looking at SSR HTML size. Every server-rendered page carried a large block of preload tags inherited from the root route, adding a few KB of inline path strings to the critical TTFB payload regardless of which page the user actually requested.
Minimal reproducible example#
https://github.com/ZacharyL2/tsr-modulepreload-repro
Steps to reproduce#
git clone https://github.com/ZacharyL2/tsr-modulepreload-repro
cd tsr-modulepreload-repro
pnpm install
pnpm build
pnpm inspect
Output: root preloads: 156. 214 routes with typical head() / loader() — triggers the issue naturally.
Expected behavior#
Root should only carry the entry chunk and truly shared deps, not chunks owned by specific routes.
Platform#
@tanstack/start-plugin-core: 1.167.35
@tanstack/react-start: 1.167.41
@tanstack/react-router: 1.168.22
vite: 8.0.8 (Rolldown)
Real-world observation (production app, 152 routes)#
- Root preloads: 82
/ modulepreloads: 103
please provide a reproducer project that actually exhibits this issue without having to simulate