mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-18 23:41:18 +00:00
fix(nuxt): warn when definePageMeta
does not receive an object (#31156)
This commit is contained in:
parent
1baf3ebad6
commit
d337a78755
@ -247,7 +247,10 @@ export async function getRouteMeta (contents: string, absolutePath: string, extr
|
||||
|
||||
foundMeta = true
|
||||
const pageMetaArgument = node.expression.arguments[0]
|
||||
if (pageMetaArgument?.type !== 'ObjectExpression') { return }
|
||||
if (pageMetaArgument?.type !== 'ObjectExpression') {
|
||||
logger.warn(`\`definePageMeta\` must be called with an object literal (reading \`${absolutePath}\`).`)
|
||||
return
|
||||
}
|
||||
|
||||
for (const key of extractionKeys) {
|
||||
const property = pageMetaArgument.properties.find((property): property is Property => property.type === 'Property' && property.key.type === 'Identifier' && property.key.name === key)
|
||||
|
Loading…
Reference in New Issue
Block a user