How to use createLazyFileRoute with VirtualRoutes? #3854
Replies: 1 comment 3 replies
-
before diving into this deeper, why do you need manual lazy routes? did you have a look at automatic codesplitting? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I added
.lazy
suffix for my file, which contains this code:export const Route = createFileRoute("/_Providers/_Layout/partner/home")({ component: PartnerHomePage, });
However, I can't just put
createLazyFileRoute
here. I'll receive TS issue, becauserouteTree.gen.ts
declare this route withcreateFileRoute
.Code from
routeTree.gen.ts
:const PartnerHomePartnerHomePagelazyRoute = PartnerHomePartnerHomePagelazyImport.update({ id: '/home', path: '/home', getParentRoute: () => PartnerLayoutLayoutRoute, } as any)
You could reproduce this issue with your own example - https://github.com/TanStack/router/tree/main/examples/react/basic-virtual-file-based. If you change
home.tsx
tohome.lazy.tsx
, you will see ts error and eslint will replacecreateLazyFileRoute
oncreateFileRoute
on save.Beta Was this translation helpful? Give feedback.
All reactions