reload in case of missing chunk ( e.g. site updated)

This commit is contained in:
Aldarund 2018-09-22 17:41:27 +03:00
parent 7a68e1dde1
commit 0eb928eba9

View File

@ -140,6 +140,9 @@ async function loadAsyncComponents (to, from, next) {
next()
} catch (err) {
err = err || {}
if (/^Loading chunk (\d)+ failed\./.test(err.message) && process.client) {
window.location.replace(location.href)
}
const statusCode = (err.statusCode || err.status || (err.response && err.response.status) || 500)
this.error({ statusCode, message: err.message })
this.$nuxt.$emit('routeChanged', to, from, err)