vuejs / router

🚦 The official router for Vue.js

Home Page:https://router.vuejs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

在用户断网期间点击过的路由,网络恢复后无法访问

QUALIAZX opened this issue · comments

Version

4.0.14

Reproduction link

github.com

Steps to reproduce

  1. 运行并打开项目
  2. f12 - network选项,断网(no throttling -> offline)
  3. 点击page2,此时console将会显示错误信息
  4. f12 - network选项,恢复网络连接(offline -> no throttling)
  5. 再次点击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
  6. 但此时page3能够访问,因为断网期间并没有访问过它

What is expected?

恢复网络连接后能够访问在断网期间点击的路由

What is actually happening?

page2在恢复网络连接后再也无法访问了,此时必须访问者手动刷新页面才能够恢复访问


这个问题似乎在使用旧版本以webpack编写的vue-cli运行/打包时不会出现,仅出现在vite创建的vue3项目中,我猜想会不会是webpack中包含有某些loader对其状态做了处理?

commented

I wrote a library to attempt to solve this issue, https://github.com/cj0x39e/retrying-dynamic-import