mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
fix(nuxt): fix syntax error when serializing route meta (#25515)
This commit is contained in:
parent
b485012f22
commit
50d69bff3a
@ -457,7 +457,7 @@ export function normalizeRoutes (routes: NuxtPage[], metaImports: Set<string> =
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (route.meta != null) {
|
if (route.meta != null) {
|
||||||
metaRoute.meta = `{ ...(${metaImportName}) || {}), ...${route.meta} }`
|
metaRoute.meta = `{ ...(${metaImportName} || {}), ...${route.meta} }`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (route.alias != null) {
|
if (route.alias != null) {
|
||||||
|
@ -1,4 +1,14 @@
|
|||||||
{
|
{
|
||||||
|
"pushed route, skips generation from file": [
|
||||||
|
{
|
||||||
|
"alias": "["pushed-route-alias"].concat(mockMeta?.alias || [])",
|
||||||
|
"component": "() => import("pages/route-file.vue").then(m => m.default || m)",
|
||||||
|
"meta": "{ ...(mockMeta || {}), ...{"someMetaData":true} }",
|
||||||
|
"name": "mockMeta?.name ?? "pushed-route"",
|
||||||
|
"path": "mockMeta?.path ?? "/"",
|
||||||
|
"redirect": "mockMeta?.redirect",
|
||||||
|
},
|
||||||
|
],
|
||||||
"route without file": [
|
"route without file": [
|
||||||
{
|
{
|
||||||
"alias": "["sweet-home"]",
|
"alias": "["sweet-home"]",
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
{
|
{
|
||||||
|
"pushed route, skips generation from file": [
|
||||||
|
{
|
||||||
|
"alias": "["pushed-route-alias"]",
|
||||||
|
"component": "() => import("pages/route-file.vue").then(m => m.default || m)",
|
||||||
|
"meta": "{"someMetaData":true}",
|
||||||
|
"name": ""pushed-route"",
|
||||||
|
"path": ""/"",
|
||||||
|
},
|
||||||
|
],
|
||||||
"route without file": [
|
"route without file": [
|
||||||
{
|
{
|
||||||
"alias": "["sweet-home"]",
|
"alias": "["sweet-home"]",
|
||||||
|
@ -542,6 +542,18 @@ describe('pages:generateRoutesFromFiles', () => {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
description: 'pushed route, skips generation from file',
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
name: 'pushed-route',
|
||||||
|
path: '/',
|
||||||
|
alias: ['pushed-route-alias'],
|
||||||
|
meta: { someMetaData: true },
|
||||||
|
file: `${pagesDir}/route-file.vue`,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
const normalizedResults: Record<string, any> = {}
|
const normalizedResults: Record<string, any> = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user