Different code splitting behavior when using `autoCodeSplitting: true` vs splitting with .lazy.tsx
I was looking at my bundle and noticed that a dependency that is used in a route was included in the main bundle. I have
autoCodeSplitting: true
so I would expect it to be split into a separate route, but unless I manually split the route using .lazy.tsx
, it gets included in the main bundle when built. Am I misunderstanding how auto codesplitting is supposed to work?4 Replies
stormy-gold•2mo ago
.lazy is not required for autoCodeSplitting
can you provide a complete example project ?
ratty-blushOP•2mo ago
I realized the cause, we had set
enableRouteGeneration: command === 'serve',
in order to make it not regenerate the routes when building (the assumption being that the routes had been generated and shouldn't be changing during builds), removing this fixed itstormy-gold•2mo ago
hm can you please create a github issue for this? code splitting should still work even with enableRouteGenerator = false
ratty-blushOP•2mo ago
Sure, I created one