Lazy loading routes with "virtual file routes"
I am trying to make one of my routes component lazy loaded but don't know what to follow from the docs
https://tanstack.com/router/latest/docs/framework/react/guide/code-splitting
like if I have route with loader what should follow from the docs ?
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...
6 Replies
ratty-blushOP•5mo ago
https://github.com/Mohammedelsayed412/tanstack-start-virtual-file-routes-build-issue
I try to use this https://tanstack.com/router/latest/docs/framework/react/api/router/lazyRouteComponentFunction from docs, but it stuck in "defaultPendingComponent" from router config, when try to lazy load about page
* And also how can now get access to about loader if I should split my component in another file ?
GitHub
GitHub - Mohammedelsayed412/tanstack-start-virtual-file-routes-buil...
Contribute to Mohammedelsayed412/tanstack-start-virtual-file-routes-build-issue development by creating an account on GitHub.
lazyRouteComponent function | TanStack Router React Docs
[!IMPORTANT] If you are using file-based routing, it's recommended to use the createLazyFileRoute function instead. The lazyRouteComponent function can be used to create a one-off code-split route com...
constant-blue•5mo ago
dont use manual lazy with start
start uses autoCodeSplitting
ratty-blushOP•5mo ago
I tried it but not working may this because it mentioned in docs that it only works with file-based routing ?

constant-blue•5mo ago
virtual file routes are also file-based somehow
what did not work exactly?
you dont have to configure anything for that really
ratty-blushOP•5mo ago
I try it but can't see the bundle of my about route in dev tools when navigate to it, do you have better way to test if it works or not ?
constant-blue•5mo ago
do a prod build and inspect the assets