TanStack / router

🤖 Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering.
https://tanstack.com/router
MIT License
8.08k stars 626 forks source link

Not found, pending, and error components are not automatically code split #2524

Open reihwald opened 2 weeks ago

reihwald commented 2 weeks ago

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 method. This for example makes sense if a popup with a large bundle footprint that I do not want in my main bundle is displayed by the route component and if the not found or error components should also display a popup.

Automatic code splitting however includes these three component types in the main bundle.

Your Example Website or App

https://stackblitz.com/edit/github-8suvfc?file=src%2Froutes%2Fabout.tsx

Steps to Reproduce the Bug or Issue

Expected behavior

I'd expect to have the possibility of automatically code splitting the not found, pending, and error components.

Or is this maybe by design and should only be active if explicitly asked for?

Screenshots or Videos

No response

Platform

Additional context

No response

schiller-manuel commented 2 weeks ago

this is not implemented right now, but could be done for sure. reach out on discord for further discussions as this feature is quite involved.