main.ts 1.5 KB
Newer Older
V
vben 已提交
1
import '/@/design/index.less';
2
import '@virtual/windi.css';
V
vben 已提交
3

V
Vben 已提交
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');
}

陈文彬 已提交
12
import { createApp } from 'vue';
V
vben 已提交
13
import App from './App.vue';
V
vben 已提交
14

陈文彬 已提交
15 16
import router, { setupRouter } from '/@/router';
import { setupStore } from '/@/store';
V
vben 已提交
17
import { setupErrorHandle } from '/@/logics/error-handle';
V
vben 已提交
18
import { setupGlobDirectives } from '/@/directives';
V
vben 已提交
19 20
import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp';
V
vben 已提交
21

22 23 24
// router-guard
import '/@/router/guard';

25
// Register icon Sprite
V
Vben 已提交
26 27
import 'vite-plugin-svg-icons/register';

28
import { isDevMode } from '/@/utils/env';
V
vben 已提交
29

30 31 32 33
(async () => {
  const app = createApp(App);
  // Register global components
  registerGlobComp(app);
V
vben 已提交
34

35 36
  // Configure routing
  setupRouter(app);
V
vben 已提交
37

38 39
  // Configure vuex store
  setupStore(app);
V
vben 已提交
40

41 42
  // Register global directive
  setupGlobDirectives(app);
陈文彬 已提交
43

44 45
  // Configure global error handling
  setupErrorHandle(app);
陈文彬 已提交
46

47
  // Mount when the route is ready
V
Vben 已提交
48
  await Promise.all([setupI18n(app), router.isReady()]);
V
vben 已提交
49

50
  app.mount('#app', true);
陈文彬 已提交
51

52 53
  // The development environment takes effect
  if (isDevMode()) {
54
    // app.config.performance = true;
55 56 57
    window.__APP__ = app;
  }
})();