fix(admin-web): auto-reload on stale dynamic-import chunks after deploy

Listen for vite:preloadError and router onError, force a one-shot reload
(10s cooldown via sessionStorage) when a hashed lazy-loaded module 404s
because a new deploy replaced it. Eliminates the user-visible "Failed to
fetch dynamically imported module" error on login and route navigation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-11 17:47:51 +08:00
parent c16a684add
commit 18011a7892
3 changed files with 64 additions and 0 deletions
+3
View File
@@ -53,11 +53,14 @@ import { createApp } from 'vue'
import 'ant-design-vue/dist/reset.css'
import App from './App.vue'
import { i18n } from './i18n'
import { registerChunkReloadHandlers } from './lib/chunk-reload'
import { subscribeAuthExpired, subscribeStoredSession } from './lib/session'
import { router } from './router'
import { pinia } from './stores/pinia'
import './styles.css'
registerChunkReloadHandlers()
const queryClient = new QueryClient({
defaultOptions: {
queries: {