import type { Component } from "vue" import Vue from "vue" import { VaguerComponents } from "../src" import Layout from "./layout.vue" Vue.use(VaguerComponents); (async () => { // @ts-expect-error 由于@somebuild/build-component-vue2没有导出vite的类型导致glob无法识别,暂时忽略 const apps = import.meta.glob("./src/**/*.vue") const name = location.pathname.replace(/^\//, "") || "App" const file = apps[`./src/${name}.vue`] if (!file) { location.pathname = "App" return } const App = ((await file()) as { default: Component }).default const app = new Vue({ render: h => h(Layout, {}, [h(App)]), }) app.$mount("#app") })()