mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
fix(vue-app): Fix default error handler in production
This commit is contained in:
parent
5568d4aa9a
commit
96892c5341
@ -31,7 +31,7 @@ const NUXT = window.<%= globals.context %> || {}
|
||||
|
||||
Object.assign(Vue.config, <%= serialize(vue.config) %>)<%= isTest ? '// eslint-disable-line' : '' %>
|
||||
|
||||
<% if (debug || mode === 'spa') { %>
|
||||
<% if (debug) { %>
|
||||
// Setup global Vue error handler
|
||||
if (!Vue.config.$nuxt) {
|
||||
const defaultErrorHandler = Vue.config.errorHandler
|
||||
@ -70,13 +70,14 @@ if (!Vue.config.$nuxt) {
|
||||
}
|
||||
Vue.config.$nuxt.<%= globals.nuxt %> = true
|
||||
<% } %>
|
||||
const errorHandler = Vue.config.errorHandler || console.error
|
||||
|
||||
// Create and mount App
|
||||
createApp()
|
||||
.then(mountApp)
|
||||
.catch((err) => {
|
||||
err.message = '[nuxt] Error while mounting app: ' + err.message
|
||||
Vue.config.errorHandler(err)
|
||||
errorHandler(err)
|
||||
})
|
||||
|
||||
function componentOption(component, key, ...args) {
|
||||
@ -685,7 +686,7 @@ async function mountApp(__app) {
|
||||
// Push the path and then mount app
|
||||
router.push(path, () => mount(), (err) => {
|
||||
if (!err) return mount()
|
||||
Vue.config.errorHandler(err)
|
||||
errorHandler(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user