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
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
  // Multilingual configuration
  await setupI18n(app);
37

38 39
  // Configure routing
  setupRouter(app);
V
vben 已提交
40

41 42
  // Configure vuex store
  setupStore(app);
V
vben 已提交
43

44 45
  // Register global directive
  setupGlobDirectives(app);
陈文彬 已提交
46

47 48
  // Configure global error handling
  setupErrorHandle(app);
陈文彬 已提交
49

50 51
  // Mount when the route is ready
  await router.isReady();
V
vben 已提交
52

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

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