fix(nuxt): only log boot errors on client-side (#19553)

This commit is contained in:
Daniel Roe 2023-03-09 14:37:39 +00:00 committed by GitHub
parent 50f0ec6a21
commit a313f06261
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -197,11 +197,11 @@ export function createNuxtApp (options: CreateOptions) {
window.addEventListener('nuxt.preloadError', (event) => {
nuxtApp.callHook('app:chunkError', { error: (event as Event & { payload: Error }).payload })
})
}
// 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