[Vuejs]-Browser caching issue with code-splitting in production? (Failed to fetch dynamically imported module)

0👍

There is a GitHub issue for this with a lot of discussion and suggestions. I like this approach, where you force a page reload to the URL that could not be resolved:

router.onError((error, to) => {
  if (error.message.includes('Failed to fetch dynamically imported module')) {
    window.location = to.fullPath
  }
})

It is almost seamless and has minimal overhead on your side.

Leave a comment