T
TanStack13mo ago
genetic-orange

[SOLVED] Is there any way to use the route named as literally "route"?

Hello. I'm using TanStack Router v1. Is there any way to use the route named as literally "route", with codegen enabled? I tried %72oute.lazy.tsx , but it seems not working. Thanks. Here's quick implementation which explains what I tried: https://github.com/LumaKernel/hello-tanstack-react-router-1/tree/main/src/routes
Failed to fetch dynamically imported module: http://localhost:2929/src/routes/%72oute.lazy.tsx
Failed to fetch dynamically imported module: http://localhost:2929/src/routes/%72oute.lazy.tsx
GitHub
hello-tanstack-react-router-1/src/routes at main · LumaKernel/hello...
Contribute to LumaKernel/hello-tanstack-react-router-1 development by creating an account on GitHub.
No description
7 Replies
solid-orange
solid-orange13mo ago
Like I mentioned in the thread.
Its one of the reserved keywords/tokens. https://tanstack.com/router/latest/docs/framework/react/guide/file-based-routing#file-naming-conventions
File-Based Routing | TanStack Router React Docs
Most of the TanStack Router documentation is written for file-based routing. This guide is mostly intended to help you understand in more detail how to configure file-based routing and the technical details behind how it works. Prerequisites
solid-orange
solid-orange13mo ago
We'd likely have to re-architect all the file-based tokens in one-go if such a change was to happen.
optimistic-gold
optimistic-gold13mo ago
maybe making a directory named route/ would work
solid-orange
solid-orange13mo ago
might work 🤔 looking at the source, we are only checking the end of the file path. https://github.com/TanStack/router/blob/8e61210183215162ae76311d8e5e6939969d2837/packages/router-generator/src/generator.ts#L103
GitHub
router/packages/router-generator/src/generator.ts at 8e612101832151...
🤖 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
genetic-orange
genetic-orangeOP13mo ago
curl 'http://localhost:2929/src/routes/%2572oute.lazy.tsx' hmm, it returns the script maybe TanStack Router expected. might be Vite + TanStack Router interpolation problem...? Thank you a lot! I'll see these documents.
solid-orange
solid-orange13mo ago
👍🏼 Just keep in mind that vite in dev behaves a bit differently.
genetic-orange
genetic-orangeOP13mo ago
maybe making a directory named route/ would work
it worked! Thanks :ablobcaramelldansen: Yes, yes, I missed this idea somehow. :ablobdizzy: by the way, I tried these keywords to search in document before opening this question: escape, percent, encoding, decoding, dollar, special it'd be helpful if there're hits for them. :ablobblewobble:

Did you find this page helpful?