Is it possible to mix with classic routes? #185
-
We already have a lot of routes defined and want to use this plugin only for a specific part of the app. So I configured the plugin, const router = createRouter({
history: createWebHashHistory(),
routes: [
// already defined routes...
{
path: "...",
children: autoRoutes,
} The problem now is that I have a lot of errors across our codebase when using
Is there a way to mix both types of routes? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
While not documented yet, you can pass a Any route added at runtime cannot be typed. In order for your types to be useful, you should let the plugin handle all (or almost all) of your routes, otherwise you lose the type safety. The plugin should expose enough options to scan for different folders though. I need to add more docs but the code has a lot of documentation so using auto complete in your IDE should show you a lot of help, especially with the config which is not fully documented in the readme but is in the source |
Beta Was this translation helpful? Give feedback.
While not documented yet, you can pass a
beforeWriteFiles
option to the unplugin in your vite config to add routes manually at build time. These will be also typed.Any route added at runtime cannot be typed. In order for your types to be useful, you should let the plugin handle all (or almost all) of your routes, otherwise you lose the type safety. The plugin should expose enough options to scan for different folders though. I need to add more docs but the code has a lot of documentation so using auto complete in your IDE should show you a lot of help, especially with the config which is not fully documented in the readme but is in the source