mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
Merge branch 'aldarund-missing-chunk-reload' into dev
This commit is contained in:
commit
5568d4aa9a
@ -145,8 +145,19 @@ async function loadAsyncComponents(to, from, next) {
|
|||||||
// Call next()
|
// Call next()
|
||||||
next()
|
next()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const error = this.error(err)
|
err = err || {}
|
||||||
this.<%= globals.nuxt %>.$emit('routeChanged', to, from, error)
|
const statusCode = err.statusCode || err.status || (err.response && err.response.status) || 500
|
||||||
|
const message = err.message || ''
|
||||||
|
|
||||||
|
// Handle chunk loading errors
|
||||||
|
// This may be due to a new deployment or a network problem
|
||||||
|
if (/^Loading chunk (\d)+ failed\./.test(message)) {
|
||||||
|
window.location.reload(true /* skip cache */)
|
||||||
|
return // prevent error page blinking for user
|
||||||
|
}
|
||||||
|
|
||||||
|
this.error({ statusCode, message })
|
||||||
|
this.$nuxt.$emit('routeChanged', to, from, err)
|
||||||
next(false)
|
next(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user