Why does route.tsx
not working fine in a file-based router combined with virtual file router?
#5307
Unanswered
cristi-shoreline
asked this question in
Q&A
Replies: 1 comment
-
A workaround that I found is to:
export const routes = rootRoute('root.tsx', [
index('index.tsx'),
// Add the folder "root" route
route('/posts', 'posts/route.tsx'),
// Mount the `posts` directory under the `/posts` path
physical('/posts', 'posts'),
]) However, it still seems hacky, and I'm not entirely happy with this workaround. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
👋 Hello, folks!
I'm having an issue combining the virtual file router with some file-based defined routes.
This is the example from the docs (simplified for clarity):
Now, in the
posts
directory, I have anindex.tsx
file which (correctly) generates the following code:However, I'd also like to match the route itself,
/posts
, not just the index, so the logical way to do it was to add aroute.tsx
(this works when using file-based routing without virtual file routes).Adding it to the
posts
directory generates the exact same content, matching the index.What I'm trying to get is the following:
Any idea on how to match the route in such a scenario?
Beta Was this translation helpful? Give feedback.
All reactions