From 0eb928eba9472c72412ef1ecc9f41a3ec51bdbd1 Mon Sep 17 00:00:00 2001 From: Aldarund Date: Sat, 22 Sep 2018 17:41:27 +0300 Subject: [PATCH] reload in case of missing chunk ( e.g. site updated) --- lib/app/client.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/app/client.js b/lib/app/client.js index 5fc86c11ab..dddb42b067 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -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)