main.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import '/@/design/index.less';
  2. import '@virtual/windi.css';
  3. // Do not introduce` on-demand in local development?
  4. // In the local development for on-demand introduction, the number of browser requests will increase by about 20%.
  5. // Which may slow down the browser refresh.
  6. // Therefore, all are introduced in local development, and only introduced on demand in the production environment
  7. if (import.meta.env.DEV) {
  8. import('ant-design-vue/dist/antd.less');
  9. }
  10. import { createApp } from 'vue';
  11. import App from './App.vue';
  12. import router, { setupRouter } from '/@/router';
  13. import { setupStore } from '/@/store';
  14. import { setupErrorHandle } from '/@/logics/error-handle';
  15. import { setupGlobDirectives } from '/@/directives';
  16. import { setupI18n } from '/@/locales/setupI18n';
  17. import { registerGlobComp } from '/@/components/registerGlobComp';
  18. // router-guard
  19. import '/@/router/guard';
  20. // Register icon Sprite
  21. import 'vite-plugin-svg-icons/register';
  22. (async () => {
  23. const app = createApp(App);
  24. // Register global components
  25. registerGlobComp(app);
  26. // Multilingual configuration
  27. await setupI18n(app);
  28. // Configure routing
  29. setupRouter(app);
  30. // Configure vuex store
  31. setupStore(app);
  32. // Register global directive
  33. setupGlobDirectives(app);
  34. // Configure global error handling
  35. setupErrorHandle(app);
  36. // Mount when the route is ready
  37. // https://next.router.vuejs.org/api/#isready
  38. await router.isReady();
  39. app.mount('#app', true);
  40. })();