diff --git a/app/plugins/0.chunkerror.client.ts b/app/plugins/0.chunkerror.client.ts new file mode 100644 index 000000000..4d1b9b235 --- /dev/null +++ b/app/plugins/0.chunkerror.client.ts @@ -0,0 +1,17 @@ +// Modified version based on https://github.com/nuxt/nuxt/pull/19086#issuecomment-1553385289 +export default defineNuxtPlugin((nuxtApp) => { + nuxtApp.hook('app:chunkError', ({ error }) => { + const error_list = [ + 'error loading dynamically imported module', + 'Importing a module script failed', + 'Failed to fetch dynamically imported module', + ]; + + if (typeof error.message === 'string') + for (const message of error_list) { + if (message.indexOf(error.message) > -1) { + reloadNuxtApp({ persistState: true }); + } + } + }); +}); diff --git a/app/plugins/0.update.client.ts b/app/plugins/2.update.client.ts similarity index 100% rename from app/plugins/0.update.client.ts rename to app/plugins/2.update.client.ts