T
TanStack9mo ago
plain-purple

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
other-emerald
other-emerald9mo ago
You can either enable auto codesplitting or use .lazy files
other-emerald
other-emerald9mo 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...
exotic-emerald
exotic-emerald9mo ago
auto codesplitting is recommended!
deep-jade
deep-jade9mo 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...
exotic-emerald
exotic-emerald9mo ago
yet ... do you want to contribute to this?
deep-jade
deep-jade9mo 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
exotic-emerald
exotic-emerald9mo 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
deep-jade
deep-jade9mo ago
Isn’t that how it’s currently done? Would you like to add the option of code splitting the loader as well?
exotic-emerald
exotic-emerald9mo ago
yes. everything should be configurable e.g. loader should not be split by default IMO
deep-jade
deep-jade9mo ago
What would be a situation where it would be beneficial to split the loader as well?
exotic-emerald
exotic-emerald9mo 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?