From 8374ef0ba64226711a8e21add2cdc18f06bbe759 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 20 Jan 2025 15:15:04 +0000 Subject: [PATCH] perf(nuxt): early return from plugin annotation for non-object syntax plugins --- 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 e3c31157ce..69ea8069fc 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 }