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')