fix: generate pages/index/**

This commit is contained in:
Clark Du 2017-12-02 21:45:55 +08:00 committed by Pooya Parsa
parent 32e67c7481
commit 9163e48589

View File

@ -150,8 +150,12 @@ export function flatRoutes(router, path = '', routes = []) {
if (!r.path.includes(':') && !r.path.includes('*')) {
/* istanbul ignore if */
if (r.children) {
if (path === '' && r.path === '/') {
routes.push('/')
}
flatRoutes(r.children, path + r.path + '/', routes)
} else {
path = path.replace(/^\/+$/, '/')
routes.push((r.path === '' && path[path.length - 1] === '/' ? path.slice(0, -1) : path) + r.path)
}
}