Blame view

src/main.ts 1.56 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
import { isDevMode } from '/@/utils/env';
vben authored
29
30
31
32
33
(async () => {
  const app = createApp(App);
  // Register global components
  registerGlobComp(app);
vben authored
34
35
36
  // Multilingual configuration
  await setupI18n(app);
37
38
39
  // Configure routing
  setupRouter(app);
vben authored
40
41
42
  // Configure vuex store
  setupStore(app);
vben authored
43
44
45
  // Register global directive
  setupGlobDirectives(app);
陈文彬 authored
46
47
48
  // Configure global error handling
  setupErrorHandle(app);
陈文彬 authored
49
50
51
  // Mount when the route is ready
  await router.isReady();
vben authored
52
53
  app.mount('#app', true);
陈文彬 authored
54
55
56
  // The development environment takes effect
  if (isDevMode()) {
57
    // app.config.performance = true;
58
59
60
    window.__APP__ = app;
  }
})();