From c5a84fd7e8e2b5be6bbb33ecc157e5936c874d1d Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 22 Jan 2025 09:22:44 +0000 Subject: [PATCH] perf(nuxt): early return from annotation for non-object syntax plugins (#30683) --- packages/nuxt/src/core/plugins/plugin-metadata.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/nuxt/src/core/plugins/plugin-metadata.ts b/packages/nuxt/src/core/plugins/plugin-metadata.ts index 5f9aaed68a..beba0a6901 100644 --- a/packages/nuxt/src/core/plugins/plugin-metadata.ts +++ b/packages/nuxt/src/core/plugins/plugin-metadata.ts @@ -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 }