Blame view

src/main.ts 1.49 KB
vben authored
1
import '/@/design/index.less';
2
import '@virtual/windi.css';
vben authored
3
Vben authored
4
// Do not introduce` on-demand in local development?
5
6
7
8
9
10
11
// 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');
}
陈文彬 authored
12
import { createApp } from 'vue';
vben authored
13
import App from './App.vue';
vben authored
14
陈文彬 authored
15
16
import router, { setupRouter } from '/@/router';
import { setupStore } from '/@/store';
vben authored
17
import { setupErrorHandle } from '/@/logics/error-handle';
vben authored
18
import { setupGlobDirectives } from '/@/directives';
vben authored
19
20
import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp';
vben authored
21
22
23
24
// router-guard
import '/@/router/guard';
25
// Register icon Sprite
Vben authored
26
27
import 'vite-plugin-svg-icons/register';
28
29
30
31
(async () => {
  const app = createApp(App);
  // Register global components
  registerGlobComp(app);
vben authored
32
Vben authored
33
34
35
  // Multilingual configuration
  await setupI18n(app);
36
37
  // Configure routing
  setupRouter(app);
vben authored
38
39
40
  // Configure vuex store
  setupStore(app);
vben authored
41
42
43
  // Register global directive
  setupGlobDirectives(app);
陈文彬 authored
44
45
46
  // Configure global error handling
  setupErrorHandle(app);
陈文彬 authored
47
48
  // Mount when the route is ready
Vben authored
49
  // https://next.router.vuejs.org/api/#isready
Vben authored
50
  await router.isReady();
vben authored
51
52
  app.mount('#app', true);
53
54
55
56

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