在用户断网期间点击过的路由,网络恢复后无法访问
QUALIAZX opened this issue · comments
QUALIA commented
Version
4.0.14
Reproduction link
Steps to reproduce
- 运行并打开项目
- f12 - network选项,断网(no throttling -> offline)
- 点击page2,此时console将会显示错误信息
- f12 - network选项,恢复网络连接(offline -> no throttling)
- 再次点击page2,此时无法访问page2,console显示
[Vue Router warn]: uncaught error during route navigation:
TypeError: Failed to fetch dynamically imported module: http://localhost:3000/src/views/PageChildren2.vue
- 但此时page3能够访问,因为断网期间并没有访问过它
What is expected?
恢复网络连接后能够访问在断网期间点击的路由
What is actually happening?
page2在恢复网络连接后再也无法访问了,此时必须访问者手动刷新页面才能够恢复访问
这个问题似乎在使用旧版本以webpack编写的vue-cli运行/打包时不会出现,仅出现在vite创建的vue3项目中,我猜想会不会是webpack中包含有某些loader对其状态做了处理?
Eduardo San Martin Morote commented
Duplicate of #1333
CJ commented
I wrote a library to attempt to solve this issue, https://github.com/cj0x39e/retrying-dynamic-import