I saw like this solution in the issue discussion before, it didn't work to me, or may be I didn't understand it well, it was confusing.
and about pathless layout, I read about it before in the official documentation and it didn't work also.
Anyway !
When I looked at your solution, I realized I had been overcomplicating things. I tried your approach in my project, and it worked well—at least until I ran into the following error:
Error: rootRouteNode must not be undefined. Make sure you've added your root route into the route-tree.
Make sure that you add a "__root.tsx" file to your routes directory.
The issue was that __root.jsx is still a crucial file. It’s required by the @tanstack/router-plugin/vite plugin to generate the routeTree.gen.ts file, which is then imported and initialized in the app’s entry point (/src/main.jsx in my case).
I saw like this solution in the issue discussion before, it didn't work to me, or may be I didn't understand it well, it was confusing.
and about pathless layout, I read about it before in the official documentation and it didn't work also.
Anyway !
When I looked at your solution, I realized I had been overcomplicating things. I tried your approach in my project, and it worked well—at least until I ran into the following error:
The issue was that
__root.jsxis still a crucial file. It’s required by the@tanstack/router-plugin/viteplugin to generate therouteTree.gen.tsfile, which is then imported and initialized in the app’s entry point (/src/main.jsxin my case).Here’s my
/src/main.jsx:/src/main.jsx:So, your solution works perfectly, but it just needs this small additional file:
/src/routes/__root.jsxThank you so much, I appreciate your help.
Yeah I forgot the __root.tsx sorry. It is required.