#vinxi dev & tsr generate different `routeTree.gen.ts`

22 messages · Page 1 of 1 (latest)

simple rivet
#

During CI we use tsr generate to generate the routeTree.gen.ts but it seems like this produces a different routeTree, even if we provide a tsr.config.json.

Is there a way to trigger tsr so it provides the same options that the vite plugin does?

#

Might actually belong in #1240861643462934568

vital kraken
#

why do you use tsr generate ? the build command should just build the route tree

simple rivet
#

because we run automated testing and we don't need a prod build for that

#

we want runtime from commit to first tests completed to be as short as possible

vital kraken
#

so what diff do you see in the generated file?

simple rivet
#

The problem specifically is that's it's seeing the api files as routes.

Without tsr.config.json it doesn't pick up on the tsr config in app.config.ts, I'm assuming due to the fact it's tanstack start specific config file.

If I make it so tsr.config.json mirrors the tsr setting in app.config.ts , so:
{
"appDirectory": "src",
"virtualRouteConfig": "src/virtual-routes.ts",
"routeFileIgnorePattern": ".(spec|test).ts"
}

then the route tree contains imports such as
import { Route as ApiFooBarImport } from './routes/api/foo/bar'

#

temporary workaround that we went with after posting this was adding the api folder in the routeFileIgnorePattern

vital kraken
#

cc @onyx copper

#

i think for start tsr is just not compatible

#

so it would need to be aware of start being used

simple rivet
#

Yeah either that or start needs its own cli

vital kraken
#

it will most likely get one, so that would be a nice use case

onyx copper
#

This probably also has a little bit to do with the different generator configs being used.

simple rivet
#

Also am I correct in thinking that start uses tsr core logic under the hood but that it has a few default options, like ignoring the api files by default?

onyx copper
# simple rivet Also am I correct in thinking that start uses tsr core logic under the hood but ...
GitHub

🤖 Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering. - TanStack/router

#

We moved to that flag since it was causing issues for Router-only users.

#

Definitely didn't consider your use case at the time 😅

simple rivet
#

That's alright, the workaround using tsr.config.json with a regex ignoring the api folder works for us now.

#

Actually we can use __enableAPIRoutesGeneration in tsr.config.json it seems