feat: 重构插件初始化逻辑,简化应用启动流程并添加调试工具支持
This commit is contained in:
17
src/main.ts
17
src/main.ts
@ -1,19 +1,6 @@
|
||||
import './styles';
|
||||
|
||||
import App from './App.vue';
|
||||
import { setupPlugins } from './plugins';
|
||||
|
||||
async function init() {
|
||||
const app = createApp(App);
|
||||
{
|
||||
// https://github.com/antfu-collective/vitesse/blob/47618e72dfba76c77b9b85b94784d739e35c492b/src/modules/README.md
|
||||
type UserPluginContext = { app: import('vue').App<Element> };
|
||||
type UserPlugin = (ctx: UserPluginContext) => void;
|
||||
Object.values(import.meta.glob<{ install: UserPlugin }>('./plugins/*.ts', { eager: true })).forEach((i) =>
|
||||
i.install?.({ app }),
|
||||
);
|
||||
}
|
||||
|
||||
app.mount('#app');
|
||||
}
|
||||
|
||||
init();
|
||||
setupPlugins(createApp(App)).mount('#app');
|
||||
|
Reference in New Issue
Block a user