Loading chunk {n} failed问题
原文:https://segmentfault.com/a/1190000016382323
vue-router错误处理函数
router.onError((error) => { const pattern = /Loading chunk (\d)+ failed/g; const isChunkLoadFailed = error.message.match(pattern); const targetPath = router.history.pending.fullPath; if (isChunkLoadFailed) { router.replace(targetPath); } });