Vben
2021-03-16 3732016062ca586c7d7ad7aa5e479c423be77871
提交 | 用户 | age
4d7001 1 import '/@/design/index.less';
9e3ada 2 import '@virtual/windi.css';
4d7001 3
373201 4 // Do not introduce` on-demand in local development?
a9462f 5 // In the local development for on-demand introduction, the number of browser requests will increase by about 20%.
V 6 // Which may slow down the browser refresh.
7 // Therefore, all are introduced in local development, and only introduced on demand in the production environment
8 if (import.meta.env.DEV) {
9   import('ant-design-vue/dist/antd.less');
10 }
11
2f6253 12 import { createApp } from 'vue';
73c8e0 13 import App from './App.vue';
70fba7 14
2f6253 15 import router, { setupRouter } from '/@/router';
16 import { setupStore } from '/@/store';
eba557 17 import { setupErrorHandle } from '/@/logics/error-handle';
2e79c9 18 import { setupGlobDirectives } from '/@/directives';
99ac30 19 import { setupI18n } from '/@/locales/setupI18n';
V 20 import { registerGlobComp } from '/@/components/registerGlobComp';
b7ce74 21
V 22 // router-guard
23 import '/@/router/guard';
46e087 24
491f1f 25 // Register icon Sprite
9c2a2a 26 import 'vite-plugin-svg-icons/register';
V 27
43503d 28 import { isDevMode } from '/@/utils/env';
2f6253 29
f6cef1 30 (async () => {
V 31   const app = createApp(App);
32   // Register global components
33   registerGlobComp(app);
46e087 34
d5d4c4 35   // Multilingual configuration
V 36   await setupI18n(app);
b7ce74 37
f6cef1 38   // Configure routing
V 39   setupRouter(app);
f24422 40
f6cef1 41   // Configure vuex store
V 42   setupStore(app);
46e087 43
f6cef1 44   // Register global directive
V 45   setupGlobDirectives(app);
2f6253 46
f6cef1 47   // Configure global error handling
V 48   setupErrorHandle(app);
2f6253 49
d5d4c4 50   // Mount when the route is ready
V 51   await router.isReady();
710158 52
bd7b53 53   app.mount('#app', true);
2f6253 54
f6cef1 55   // The development environment takes effect
V 56   if (isDevMode()) {
e0dc5c 57     // app.config.performance = true;
f6cef1 58     window.__APP__ = app;
V 59   }
60 })();