Closed thelinuxlich closed 3 years ago
The filebased routing can't be used standalone. Because the routing mechanism is coupled with ssr, theming .etc. But I think you can implement a filebased routing plugin by yourself. You can refer to this code fromvite-plugin-react-pages
:
https://github.com/vitejs/vite-plugin-react-pages/blob/daab754690e75f1a30c6bd8ea7581c2af308b465/packages/react-pages/src/node/index.ts#L66
In the client side, the bootstrap code will import pageList from '@!virtual-modules/pages';
and render routes with it.
Oh, looking at the code it doesn't seem to have id support yet, so it's kinda on the same state as my poor-man's autorouting https://github.com/thelinuxlich/react-modern-starter/blob/main/src/AutoRouting.jsx
Do you mean url parameter? I actually just supported url parameter a couple minutes ago.
I would like to add a filebased routing implementation to my starter pack https://github.com/thelinuxlich/react-modern-starter