Skip to content

Commit

Permalink
🐛 Use correct path for index routes
Browse files Browse the repository at this point in the history
Fixes #13
  • Loading branch information
kiliman committed Jun 7, 2022
1 parent f4427d6 commit f7eaa66
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function flatRoutes(
parentId: '',
index: false,
})
var routes = defineRoutes(route => {
let routes = defineRoutes(route => {
visitor(`app/${baseDir}`, routeFile => {
const routeInfo = getRouteInfo(baseDir, routeFile, options.basePath)
if (!routeInfo) return
Expand Down Expand Up @@ -192,10 +192,7 @@ export function getRouteInfo(
function appendPathSegment(url: string, segment: string) {
if (segment) {
if (['index', '_index'].some(name => segment === name)) {
// handle index route
if (!url.endsWith('/')) {
url += '/'
}
// index routes don't affect the the path
return url
}

Expand Down

0 comments on commit f7eaa66

Please sign in to comment.