mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-19 01:45:53 +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 {
|
||||
if (route.meta != null) {
|
||||
metaRoute.meta = `{ ...(${metaImportName}) || {}), ...${route.meta} }`
|
||||
metaRoute.meta = `{ ...(${metaImportName} || {}), ...${route.meta} }`
|
||||
}
|
||||
|
||||
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": [
|
||||
{
|
||||
"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": [
|
||||
{
|
||||
"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> = {}
|
||||
|
Loading…
Reference in New Issue
Block a user