TanStackT
TanStack7mo ago
16 replies
brilliant-lime

Code-splitting issue

I recently upgraded from 1.120.18 to 1.126.8. We had been stuck for a while on 1.120 because of the false positive "could not find match from" issue that got solved a few days ago (https://github.com/TanStack/router/pull/4610).

But I noticed a big increase in the size of the main JS chunk after build. So far I have traced it down to somewhere between 1.121.2 (ok) and 1.121.12 (ko). Looking a little at which chunks remain, it looks like only the stuff we code-split manually (not through tanstack) is now emitted as a separate chunk, and everything else is in the main chunk.

I'm attaching a visualization (done w/ rollup-plugin-visualizer) of the before and after. It's about a 5x increase in gzipped size.

We're using basic file routing on tanstack/react-router (no start). We don't touch the tree at all, not virtual routes or anything. The tsr.config is also very basic, with autoCodeSplitting: true. The Vite plugin has no options, but the issue remains unchanged if I try and set a custom codeSplittingOptions.defaultBehavior.

I'll try and narrow this down even more. But in the meantime: is this a known issue? Or even an intended behavior change?
Screenshot_2025-07-12_at_13.00.57.png
Screenshot_2025-07-12_at_13.01.11.png
Was this page helpful?