From b3ced3d694c89344c8e77b804a2dc76434d27668 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sun, 17 Mar 2024 16:36:29 +0100 Subject: [PATCH] fix(nuxt): ignore console.logs called outside event context resolves https://github.com/nuxt/nuxt/issues/26308 --- packages/nuxt/src/core/runtime/nitro/dev-server-logs.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/nuxt/src/core/runtime/nitro/dev-server-logs.ts b/packages/nuxt/src/core/runtime/nitro/dev-server-logs.ts index 63b955eae6..b1fd618e00 100644 --- a/packages/nuxt/src/core/runtime/nitro/dev-server-logs.ts +++ b/packages/nuxt/src/core/runtime/nitro/dev-server-logs.ts @@ -25,7 +25,9 @@ export default (nitroApp: NitroApp) => { } onConsoleLog((_log) => { - const ctx = asyncContext.use() + const ctx = asyncContext.tryUse() + if (!ctx) { return } + const stack = getStack() if (stack.includes('runtime/vite-node.mjs')) { return }