mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
fix(utils): error when router.trailingSlash
is false
(#6515)
This commit is contained in:
parent
f28d12c913
commit
2d27a4d2dc
@ -176,7 +176,7 @@ export const createRoutes = function createRoutes ({
|
||||
})
|
||||
if (trailingSlash !== undefined) {
|
||||
route.pathToRegexpOptions = { ...route.pathToRegexpOptions, strict: true }
|
||||
route.path = route.path.replace(/\/+$/, '') + (trailingSlash ? '/' : '')
|
||||
route.path = route.path.replace(/\/+$/, '') + (trailingSlash ? '/' : '') || '/'
|
||||
}
|
||||
|
||||
parent.push(route)
|
||||
|
@ -210,15 +210,6 @@ Array [
|
||||
|
||||
exports[`util: route util: route create createRoutes should remove trailing slashes when configured to 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"chunkName": "pages/index",
|
||||
"component": "/some/nuxt/app/pages/index.vue",
|
||||
"name": "index",
|
||||
"path": "",
|
||||
"pathToRegexpOptions": Object {
|
||||
"strict": true,
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"chunkName": "pages/parent/index",
|
||||
"component": "/some/nuxt/app/pages/parent/index.vue",
|
||||
@ -269,6 +260,7 @@ Array [
|
||||
],
|
||||
"chunkName": "pages/another_route/_id",
|
||||
"component": "/some/nuxt/app/pages/another_route/_id.vue",
|
||||
"name": "another_route-id",
|
||||
"path": "/another_route/:id?",
|
||||
"pathToRegexpOptions": Object {
|
||||
"strict": true,
|
||||
@ -283,6 +275,15 @@ Array [
|
||||
"strict": true,
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"chunkName": "pages/index",
|
||||
"component": "/some/nuxt/app/pages/index.vue",
|
||||
"name": "index",
|
||||
"path": "/",
|
||||
"pathToRegexpOptions": Object {
|
||||
"strict": true,
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"chunkName": "pages/_param",
|
||||
"component": "/some/nuxt/app/pages/_param.vue",
|
||||
|
Loading…
Reference in New Issue
Block a user