From 7479d469dd112117d8ea7cec2d1a1a6d6abc1141 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Feb 2023 15:06:10 +0000 Subject: [PATCH] fix(nuxt): log errors thrown when booting the nuxt app (#19187) --- packages/nuxt/src/app/nuxt.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/nuxt/src/app/nuxt.ts b/packages/nuxt/src/app/nuxt.ts index 74c7372c4b..42afeecb71 100644 --- a/packages/nuxt/src/app/nuxt.ts +++ b/packages/nuxt/src/app/nuxt.ts @@ -194,6 +194,10 @@ export function createNuxtApp (options: CreateOptions) { }) } + // Log errors captured when running plugins, in the `app:created` and `app:beforeMount` hooks + // as well as when mounting the app and in the `app:mounted` hook + nuxtApp.hook('app:error', (...args) => { console.error('[nuxt] error caught during app initialization', ...args) }) + // Expose runtime config const runtimeConfig = process.server ? options.ssrContext!.runtimeConfig