Daydreamer-riri / vite-react-ssg

Static-site generation for React on Vite.
https://vite-react-ssg.netlify.app/
MIT License
125 stars 6 forks source link

TanStack Router integration does not work with pathless routes #41

Closed ArtemSBulgakov closed 3 weeks ago

ArtemSBulgakov commented 1 month ago

Hello.

I am using "pathless" routes in my applications. It is routes that start with '_' prefix and catch all nested paths.

The file structure looks like this:

src/app/routes
├── index.tsx       # / (without menu)
├── landing.tsx     # /landing (without menu)
└── _with_menu      # This is just route id, it is not included in url
    ├── route.tsx   # This component is rendered when any child route matches
    ├── profile.tsx # /profile (with menu)
    ├── rooms.tsx   # /rooms (with menu)
    └── sport.tsx   # /sport (with menu)

TanStack Documentation: https://tanstack.com/router/latest/docs/framework/react/guide/file-based-routing#pathless-routes

Current version in main branch crashes with error while transforming paths.

https://github.com/Daydreamer-riri/vite-react-ssg/blob/c4b9b9127c54aaede5869f60b988e34cf46bbfe7/src/utils/tanstack-router.ts#L14

(node.path is undefined, and you try to call node.path.includes())

Daydreamer-riri commented 1 month ago

Hi @ArtemSBulgakov, thank you for pointing that out! Currently, support for Tanstack is still in the beta stage. Since I don't use the Tanstack router much personally, I really appreciate your feedback. If you encounter any other support issues, please let me know, and I'll address them as soon as possible.