T
TanStack3w ago
stormy-gold

How to use only certain files as routes?

How to use only specific files like __root.tsx, index.tsx, and route.tsx as route files?
1 Reply
stormy-gold
stormy-goldOP3w ago
already tried but index.tsx file is not beign recognized

tanstackStart({
router: {
routeFileIgnorePrefix: "", routeFileIgnorePattern: "^(?!(__root\\.tsx|index\\.tsx|route\\.tsx)$).*$",
},
}),

tanstackStart({
router: {
routeFileIgnorePrefix: "", routeFileIgnorePattern: "^(?!(__root\\.tsx|index\\.tsx|route\\.tsx)$).*$",
},
}),
I made it. The file names include the folder names too, so the regex should be: ^(?!.(?:__root|index|route).(ts|tsx)$)..[^.]+$

Did you find this page helpful?