T
TanStack12mo ago
flat-fuchsia

Is naming files *.lazy.tsx for pages required for lazy loading ?

Just a quick question, as the intro quick start seems to suggest you should.
11 Replies
fascinating-indigo
fascinating-indigo12mo ago
You can either enable auto codesplitting or use .lazy files
fascinating-indigo
fascinating-indigo12mo ago
Code Splitting | TanStack Router React Docs
Code splitting and lazy loading is a powerful technique for improving the bundle size and load performance of an application. Reduces the amount of code that needs to be loaded on initial page load Co...
xenial-black
xenial-black12mo ago
auto codesplitting is recommended!
conscious-sapphire
conscious-sapphire11mo ago
But does not cover all components: https://github.com/TanStack/router/issues/2524
GitHub
Not found, pending, and error components are not automatically code...
Which project does this relate to? Router Describe the bug It is possible to code split the notFoundComponent, pendingComponent and errorComponent when manually code splitting using the .lazy.tsx m...
xenial-black
xenial-black11mo ago
yet ... do you want to contribute to this?
conscious-sapphire
conscious-sapphire11mo ago
I‘d like to if it’s still open in a few months. I already took a look into this but sadly lack the time needed currently
xenial-black
xenial-black11mo ago
well hopefully it's not open anymore then 🤪 we also need a concept to make it configurable. e.g. do not split loader but component
conscious-sapphire
conscious-sapphire11mo ago
Isn’t that how it’s currently done? Would you like to add the option of code splitting the loader as well?
xenial-black
xenial-black11mo ago
yes. everything should be configurable e.g. loader should not be split by default IMO
conscious-sapphire
conscious-sapphire11mo ago
What would be a situation where it would be beneficial to split the loader as well?
xenial-black
xenial-black11mo ago
if the loader does lots of stuff? and then this causes a huge increase in bundle size probably a rare thing but we should make it configurable

Did you find this page helpful?