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

4 5 6 7 8 9 10 11
// 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 local development is introduced, and the production environment is introduced on demand
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 21
import { setupI18n } from '/@/locales/setupI18n';

import { registerGlobComp } from '/@/components/registerGlobComp';
V
vben 已提交
22

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

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

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

33 34
  // Multilingual configuration
  await setupI18n(app);
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 48
  // Mount when the route is ready
  await router.isReady();
V
vben 已提交
49

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

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