Blame view

src/main.ts 1.67 KB
vben authored
1
import '/@/design/index.less';
2
import 'virtual:windi.css';
vben authored
3
陈文彬 authored
4
import { createApp } from 'vue';
vben authored
5
import App from './App.vue';
6
import { initAppConfigStore } from '/@/logics/initAppConfig';
陈文彬 authored
7
import router, { setupRouter } from '/@/router';
Vben authored
8
import { setupRouterGuard } from '/@/router/guard';
陈文彬 authored
9
import { setupStore } from '/@/store';
vben authored
10
import { setupErrorHandle } from '/@/logics/error-handle';
vben authored
11
import { setupGlobDirectives } from '/@/directives';
vben authored
12
13
import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp';
vben authored
14
15
// Register icon Sprite
Vben authored
16
17
import 'vite-plugin-svg-icons/register';
18
19
20
21
22
23
24
25
// Do not introduce` on-demand in local development?
// In the local development for on-demand introduction, the number of browser requests will increase by about 20%.
// Which may slow down the browser refresh.
// Therefore, all are introduced in local development, and only introduced on demand in the production environment
if (import.meta.env.DEV) {
  import('ant-design-vue/dist/antd.less');
}
26
27
(async () => {
  const app = createApp(App);
Vben authored
28
29
30
31

  // Configure vuex store
  setupStore(app);
32
  // Initialize internal system configuration
33
34
  initAppConfigStore();
35
36
  // Register global components
  registerGlobComp(app);
vben authored
37
Vben authored
38
39
40
  // Multilingual configuration
  await setupI18n(app);
41
42
  // Configure routing
  setupRouter(app);
vben authored
43
Vben authored
44
45
  // router-guard
  setupRouterGuard();
vben authored
46
47
48
  // Register global directive
  setupGlobDirectives(app);
陈文彬 authored
49
50
51
  // Configure global error handling
  setupErrorHandle(app);
陈文彬 authored
52
53
  // Mount when the route is ready
Vben authored
54
  // https://next.router.vuejs.org/api/#isready
Vben authored
55
  await router.isReady();
vben authored
56
57
  app.mount('#app', true);
58
59
60
61

  if (import.meta.env.DEV) {
    window.__APP__ = app;
  }
62
})();