fix(nuxt): ignore console.logs called outside event context

resolves https://github.com/nuxt/nuxt/issues/26308
This commit is contained in:
Daniel Roe 2024-03-17 16:36:29 +01:00
parent 551ffaa9d5
commit b3ced3d694
No known key found for this signature in database
GPG Key ID: CBC814C393D93268

View File

@ -25,7 +25,9 @@ export default (nitroApp: NitroApp) => {
} }
onConsoleLog((_log) => { onConsoleLog((_log) => {
const ctx = asyncContext.use() const ctx = asyncContext.tryUse()
if (!ctx) { return }
const stack = getStack() const stack = getStack()
if (stack.includes('runtime/vite-node.mjs')) { return } if (stack.includes('runtime/vite-node.mjs')) { return }