You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Route generation does not allow plain template literals anymore after 1.166.31 #7216
now in 1.166.31+ throws this error during route generation
Error: Error transforming route file /front/spa/src/routes/$locale/_main/(offers)/-offer/$actionId/$tab.tsx:
Error: expected route id to be a string literal or plain template literal in /$locale/_main/(offers)/offers/$actionId/$tab
We were relying heavily on semi dynamic URLs (we generate routeVarOfferDefinition like consts during prepare step before TanStack Router kicks in) and actually the error implies that it should work but does not.
tsr generate fails with expected route id to be a string literal or plain template literal as About page has dynamic part.
Expected behavior
I would expect it to continute working. One of the best Tanstack Router features for our platform as we need to support deep variations for different markets.
We have several dozens of projects based on single code base. And there's business requirement to make paths customizable. The most notable case is that we have 3 types of projects:
1st needs to mount subproductA at path /subproductA and subproductB at /subproductB
2nd needs to mount subproductA at path /subproductA and subproductB at / because subproductB is the main product on current domain and we'd want URLs to be as nice as possible
3rd need to mount subproductA at path / and subproductB at /subproductB because subproductA is the main product on current domain
and then routeVar*Path goes into links and routeVar*Definition goes into routes' definition and also into __virtual.ts route definitions.
The only downside was that route files were not autoupdated when path was to be changed (like once in a year). Other than that — worked flawlessly. Not sure what was the reason to cut down on that.
Sure we can do symlinking/copying, we did that with react router before but this leads to all sorts of bugs that far overweigh inability to autoupdate paths (as they are checked by TypeScript anyway during compilation).
For us this change was not a breaker but a surprise and we need to modify our codebase a bit. We have a base ui package which exports the router /constants. And now since only string literals are allowed, we need to drop the usage of our constants. Makes refactoring a little bit more annoying.
@kompot i don't understand what you are doing with those subproducts, is it possible to provide a complete example repository that mimics your process?
Activity
schiller-manuel commentedon Apr 17, 2026
This was never supported, if so, it was accidentally.
This string is managed by router generator, derived from the file path / name.
Please provide a more detailed description of your process so we could think of a proper way to support this.
kompot commentedon Apr 17, 2026
We have several dozens of projects based on single code base. And there's business requirement to make paths customizable. The most notable case is that we have 3 types of projects:
/subproductAand subproductB at/subproductB/subproductAand subproductB at/because subproductB is the main product on current domain and we'd want URLs to be as nice as possible/and subproductB at/subproductBbecause subproductA is the main product on current domainSo we had a single configuration file like this
and then we generated fully static set of vars like this
and then
routeVar*Pathgoes into links androuteVar*Definitiongoes into routes' definition and also into__virtual.tsroute definitions.The only downside was that route files were not autoupdated when path was to be changed (like once in a year). Other than that — worked flawlessly. Not sure what was the reason to cut down on that.
Sure we can do symlinking/copying, we did that with react router before but this leads to all sorts of bugs that far overweigh inability to autoupdate paths (as they are checked by TypeScript anyway during compilation).
codeart1st commentedon Apr 27, 2026
For us this change was not a breaker but a surprise and we need to modify our codebase a bit. We have a base ui package which exports the router /constants. And now since only string literals are allowed, we need to drop the usage of our constants. Makes refactoring a little bit more annoying.
schiller-manuel commentedon Apr 27, 2026
@kompot i don't understand what you are doing with those subproducts, is it possible to provide a complete example repository that mimics your process?
kompot commentedon Apr 27, 2026
@schiller-manuel kinda like this, I made an example that would make some sense in terms of real world application (sport popularity between countries)
https://github.com/kompot/tsr-variable-compile-time-path-segments