T
TanStack•14mo ago
sunny-green

how do I add a public path prefix to the file router generator?

I'm unable to find the configuration to set the public path prefix for the router generator, e.g. it generates the route route to be on "/" - but it should be on "/core-module"
6 Replies
deep-jade
deep-jade•14mo ago
RouterOptions | TanStack Router React Docs
The RouterOptions type contains all of the options that can be used to configure a router instance. RouterOptions properties
sunny-green
sunny-greenOP•14mo ago
I'm using it but the generated paths & types use "/"
deep-jade
deep-jade•14mo ago
it is a runtime setting does not affect the generated code why do you need to have this prefix in the generated code ?
sunny-green
sunny-greenOP•14mo ago
We are in a setup with multiple applications each mapped on a route prefix - it's confusing to do "/" as it's not obvious where you end up from a DX stand point it would be great if we could skip the basePath setting and just have the generated typings include the path prefix (as it will never change) trafic -> Reverse proxy /admin/* -> user-management self contained system /core-module/* -> core feature self contained system ... We also dream combining the types from the different systems - to avoid dead links / breaking changes etc. across systems / teams
deep-jade
deep-jade•14mo ago
but couldn't you just put all your routes under a folder name e.g. /admin? then route generator would pick this up automatically
sunny-green
sunny-greenOP•14mo ago
true and then leave out the basePath runtime config? Seems to be working, thanks! 🙂

Did you find this page helpful?