fix(nuxt3): support extending page metadata (#3603)

This commit is contained in:
Daniel Roe 2022-03-11 11:52:05 +00:00 committed by GitHub
parent 8c6af7da7a
commit 32cf973ab0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -236,7 +236,7 @@ export function normalizeRoutes (routes: NuxtPage[], metaImports: Set<string> =
return { return {
...Object.fromEntries(Object.entries(route).map(([key, value]) => [key, JSON.stringify(value)])), ...Object.fromEntries(Object.entries(route).map(([key, value]) => [key, JSON.stringify(value)])),
children: route.children ? normalizeRoutes(route.children, metaImports).routes : [], children: route.children ? normalizeRoutes(route.children, metaImports).routes : [],
meta: route.meta ? JSON.stringify(route.meta) : metaImportName, meta: route.meta ? `{...(${metaImportName} || {}), ...${JSON.stringify(route.meta)}}` : metaImportName,
component: genDynamicImport(file) component: genDynamicImport(file)
} }
})) }))