Build issue when using virtual file routes in tanstack start
I face an issue when try build my demo app, and get this error
what happing is that during build it recreate "routeTree.gen.ts" but it create at as I work with file based not virtual file routes, so it deals with my "routes.ts" as route and show this error, like try to import from "routeTree.gen.ts", as you see I share the error and file config, it's very simple and work locally fine but get this during build




7 Replies
deep-jade•5mo ago
would move the routes.ts out of the routes folder. other than that, a complete minimal repro would be needed to debug this
stormy-goldOP•5mo ago
https://github.com/Mohammedelsayed412/tanstack-start-virtual-file-routes-build-issue
you can clone it and try build and will see the behavior, it simple have only one route /test
GitHub
GitHub - Mohammedelsayed412/tanstack-start-virtual-file-routes-buil...
Contribute to Mohammedelsayed412/tanstack-start-virtual-file-routes-build-issue development by creating an account on GitHub.
stormy-goldOP•5mo ago
moving "routes.ts" out is working fine, but I think it must be changes so that if I want add different files than routes
deep-jade•5mo ago
what exactly is the behavior you see?
is this only on production build?
ah I found the issue
the router plugin needs to be removed
as start handles this internally
so this works
stormy-goldOP•5mo ago
no build locally, I edit the repo, as when I add any ts file inside routes like actions/actions.ts to have my server functions it make this issue
but I need this plugin to set "TanStackRouterVite" and set path for virtual-file-routes or what you means ?
deep-jade•5mo ago
see my config above
the virtual route config needs to done inside the
tsr
propstormy-goldOP•5mo ago
yes got it, works now thanks