fix(nuxt): log errors thrown when booting the nuxt app (#19187)

This commit is contained in:
Daniel Roe 2023-02-21 15:06:10 +00:00 committed by GitHub
parent b1fd5200f5
commit 7479d469dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 // Expose runtime config
const runtimeConfig = process.server const runtimeConfig = process.server
? options.ssrContext!.runtimeConfig ? options.ssrContext!.runtimeConfig