From cf48052b82a0377578149b3e9d17922d82eca672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Tue, 21 Oct 2025 10:04:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(router-plugin):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=83=AD=E6=9B=B4=E6=96=B0=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E7=9A=84=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/router-plugin.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/router-plugin.ts b/src/plugins/router-plugin.ts index 044801d..f1d3860 100644 --- a/src/plugins/router-plugin.ts +++ b/src/plugins/router-plugin.ts @@ -13,7 +13,7 @@ const router = createRouter({ }, strict: true, }); -if (import.meta.hot) handleHotUpdate(router); + if (__DEV__) Object.assign(globalThis, { router }); router.onError((error) => { console.debug('🚨 [router error]:', error); @@ -56,3 +56,6 @@ declare module 'vue-router' { } export { createGetRoutes } from 'virtual:meta-layouts'; + +// This will update routes at runtime without reloading the page +if (import.meta.hot) handleHotUpdate(router);