-
-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: nested folders causes parent folder to use trailing slash #70
Comments
The type for the path should indeed be // articles.vue
'/articles': RouteRecordInfo<'/articles', '/articles', Record<never, never>, Record<never, never>>,
// articles/index.vue
-'/articles/': RouteRecordInfo<'/articles/', '/articles/', Record<never, never>, Record<never, never>>,
+'/articles/': RouteRecordInfo<'/articles/', '/articles', Record<never, never>, Record<never, never>>, |
That would create two named routes named
Yes, that's the name, not the path. Note you can customize the way routes are named but the point of having a named that looks like their path is to make an instant connection between both. |
Problem
When defining routes that have both sub-routes, and an index of the parent route, unplugin-vue-router will generate the parent route types including a trailing slash. This causes inconsistencies throughout the routes -- this is also a different behavior compared to vite-plugin-pages.
Description
I have the following
src/pages/
folder structure, which is used for all routing:Vite config:
And this is the auto-generated typed info from vite, that is most important to this issue:
Looking at
/dashboard/
, because it has/dashboard/guild/[id]
as a sub-path, this causes thedashboard/index.vue
page to render as/dashboard/
, where I believe it should be/dashboard
. This is the behavior I have previously seen withvite-plugin-pages
(see their readme that includes an example of a similar routing folder structure as above).Technically,
/dashboard
is still routable, however any form of typed routing will always force that route to include the trailing slash, and this leads to inconsistent trailing slashes being used throughout the frontend.Version Info
The text was updated successfully, but these errors were encountered: