mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +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' : '' %>
|
Object.assign(Vue.config, <%= serialize(vue.config) %>)<%= isTest ? '// eslint-disable-line' : '' %>
|
||||||
|
|
||||||
<% if (debug || mode === 'spa') { %>
|
<% if (debug) { %>
|
||||||
// Setup global Vue error handler
|
// Setup global Vue error handler
|
||||||
if (!Vue.config.$nuxt) {
|
if (!Vue.config.$nuxt) {
|
||||||
const defaultErrorHandler = Vue.config.errorHandler
|
const defaultErrorHandler = Vue.config.errorHandler
|
||||||
@ -70,13 +70,14 @@ if (!Vue.config.$nuxt) {
|
|||||||
}
|
}
|
||||||
Vue.config.$nuxt.<%= globals.nuxt %> = true
|
Vue.config.$nuxt.<%= globals.nuxt %> = true
|
||||||
<% } %>
|
<% } %>
|
||||||
|
const errorHandler = Vue.config.errorHandler || console.error
|
||||||
|
|
||||||
// Create and mount App
|
// Create and mount App
|
||||||
createApp()
|
createApp()
|
||||||
.then(mountApp)
|
.then(mountApp)
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
err.message = '[nuxt] Error while mounting app: ' + err.message
|
err.message = '[nuxt] Error while mounting app: ' + err.message
|
||||||
Vue.config.errorHandler(err)
|
errorHandler(err)
|
||||||
})
|
})
|
||||||
|
|
||||||
function componentOption(component, key, ...args) {
|
function componentOption(component, key, ...args) {
|
||||||
@ -685,7 +686,7 @@ async function mountApp(__app) {
|
|||||||
// Push the path and then mount app
|
// Push the path and then mount app
|
||||||
router.push(path, () => mount(), (err) => {
|
router.push(path, () => mount(), (err) => {
|
||||||
if (!err) return mount()
|
if (!err) return mount()
|
||||||
Vue.config.errorHandler(err)
|
errorHandler(err)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user