From 3a4f2177baaeec9702a6691d11726ed2116dbb01 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Fri, 11 Feb 2022 10:32:03 -0600 Subject: [PATCH] feat(play): file doesn't exist jump to App (#5985) * feat(play): file doesn't exist jump tp App * chore: update --- play/main.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/play/main.ts b/play/main.ts index f8aa3ea3b0..5a19faa86a 100644 --- a/play/main.ts +++ b/play/main.ts @@ -3,7 +3,12 @@ import '@element-plus/theme-chalk/src/index.scss' ;(async () => { const apps = import.meta.glob('./src/*.vue') const name = location.pathname.replace(/^\//, '') || 'App' - const App = (await apps[`./src/${name}.vue`]()).default + const file = apps[`./src/${name}.vue`] + if (!file) { + location.pathname = 'App' + return + } + const App = (await file()).default const app = createApp(App) app.mount('#play')