fix(nuxt3): handle falsy page meta

hotfix for #4273
This commit is contained in:
Pooya Parsa 2022-04-12 11:16:34 +02:00
parent 85f2f83cf2
commit f753938843

View File

@ -237,7 +237,7 @@ export function normalizeRoutes (routes: NuxtPage[], metaImports: Set<string> =
...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 ? `{...(${metaImportName} || {}), ...${JSON.stringify(route.meta)}}` : metaImportName, meta: route.meta ? `{...(${metaImportName} || {}), ...${JSON.stringify(route.meta)}}` : metaImportName,
alias: `${metaImportName}.alias || []`, alias: `${metaImportName}?.alias || []`,
component: genDynamicImport(file) component: genDynamicImport(file)
} }
})) }))