fix pathToRegexp generate routes

This commit is contained in:
Alexandre Chopin 2017-02-22 18:13:23 +01:00
parent 591ef50a06
commit 749673c99b
1 changed files with 2 additions and 3 deletions

View File

@ -67,10 +67,9 @@ export default function () {
console.error(`Could not generate the dynamic route ${route}, please add the mapping params in nuxt.config.js (generate.routeParams).`) // eslint-disable-line no-console console.error(`Could not generate the dynamic route ${route}, please add the mapping params in nuxt.config.js (generate.routeParams).`) // eslint-disable-line no-console
return process.exit(1) return process.exit(1)
} }
route = route + '?' const toPathRegexp = pathToRegexp.compile(route)
const toPath = pathToRegexp.compile(route)
routes = routes.concat(routeParams.map((params) => { routes = routes.concat(routeParams.map((params) => {
return toPath(params) return toPathRegexp(params)
})) }))
} else { } else {
routes.push(route) routes.push(route)