File-based routing bug or misconfig?
Tldr: I'm using file-based routing and the CLI sets all routes as children of rootRoute, which is unexpected
Note the paths and getParentRoute calls in the generated file here:
Here's my config, full routeTree.gen.ts, and file structure: https://gist.github.com/Swizec/234a686fa18332cd488188f161c3b796
11 Replies
unwilling-turquoise•2y ago
Dumb question. But are you on the latest version of the CLI?
exotic-emeraldOP•2y ago
this is from beta.231 yesterday
unwilling-turquoise•2y ago
Hmm. Have you tried cloning a file based example?
If that works, then it’s a config issue, if it doesn’t, it’s a bug.
exotic-emeraldOP•2y ago
I was starting from the file-based example you had up last week. Will compare with the new examples and get back to you
unwilling-turquoise•2y ago
Sounds good
Any movement here?
exotic-emeraldOP•2y ago
Sorry I spent all week dealing with a *** security requirement instead 🫠
I’ll have an update on Monday
unwilling-turquoise•2y ago
No worries or rush
exotic-emeraldOP•2y ago
@Tanner Linsley I figured it out! I'm an idiot. Didn't realize that you needed to have a matching
page.tsx file and /page folder to make this work.
was trying all sorts of different magic names like _layout.tsx and __root.tsxunwilling-turquoise•2y ago
Oh man! 🤦
Let's get that added to the docs or something
or if you have any other ideas on how to make that more clear
exotic-emeraldOP•2y ago
I think if your example didn't use
_layout I'd get it right away. _layout looks like a magic name because of other frameworks
nextjs specifically uses a layout.tsx placed anywhere in your directory tree as the layout for all subpagesunwilling-turquoise•2y ago
Ah I see. I can change that easy