T
TanStack13mo ago
extended-salmon

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
extended-salmon
extended-salmonOP13mo 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
}
}
sensitive-blue
sensitive-blue13mo ago
you need to create a separate tsconfig.json for each app otherwise you cannot use the module augmentation
extended-salmon
extended-salmonOP13mo ago
this means inside of that folder and subfolders the types will work accordingly?
sensitive-blue
sensitive-blue13mo ago
see how the router monorepo and especially the examples are structured
extended-salmon
extended-salmonOP13mo 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?
sensitive-blue
sensitive-blue13mo ago
separate tsconfig is necessary
extended-salmon
extended-salmonOP13mo ago
ok I will give it a try. Thanks for your reply

Did you find this page helpful?