mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-22 11:22:43 +00:00
perf(nuxt): early return from plugin annotation for non-object syntax plugins
This commit is contained in:
parent
f458153d9f
commit
8374ef0ba6
@ -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