T
TanStack10mo ago
optimistic-gold

How would multiple apps with Vite and router looks like?

I have currently a mono repo and want to migrate it into one package with just multiple starting points via ENV variable. How would that work in terms of the typescript types? Its all together 4 apps with different routes but all share the same UI kit, backend and thats why it would make sense to just run them in one package. The mono repo gives me headache and I would love to get rid of this complication.
7 Replies
optimistic-gold
optimistic-goldOP10mo ago
So I think that each env variable would point to a different folder where the starting point of the routes are placed. I wonder how that would work because multiple times would be the declaration of the route interface
declare module '@tanstack/react-router' {
interface Register {
router: typeof router
}
}
declare module '@tanstack/react-router' {
interface Register {
router: typeof router
}
}
conscious-sapphire
conscious-sapphire10mo ago
you need to create a separate tsconfig.json for each app otherwise you cannot use the module augmentation
optimistic-gold
optimistic-goldOP10mo ago
this means inside of that folder and subfolders the types will work accordingly?
conscious-sapphire
conscious-sapphire10mo ago
see how the router monorepo and especially the examples are structured
optimistic-gold
optimistic-goldOP10mo ago
I do have a monorepo now, but I would love to simply the setup into one package. you are saying that would not work?
conscious-sapphire
conscious-sapphire10mo ago
separate tsconfig is necessary
optimistic-gold
optimistic-goldOP10mo ago
ok I will give it a try. Thanks for your reply

Did you find this page helpful?