mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-22 11:22:43 +00:00
perf(nuxt): early return from annotation for non-object syntax plugins (#30683)
This commit is contained in:
parent
a8a43a9203
commit
2a29482f61
@ -44,6 +44,9 @@ export async function extractMetadata (code: string, loader = 'ts' as 'ts' | 'ts
|
||||
if (metaCache[code]) {
|
||||
return metaCache[code]
|
||||
}
|
||||
if (code.match(/defineNuxtPlugin\s*\([\w(]/)) {
|
||||
return {}
|
||||
}
|
||||
const js = await transform(code, { loader })
|
||||
parseAndWalk(js.code, `file.${loader}`, (node) => {
|
||||
if (node.type !== 'CallExpression' || node.callee.type !== 'Identifier') { return }
|
||||
|
Loading…
Reference in New Issue
Block a user