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

// Register windi
4
import 'virtual:windi.css';
5 6
// Register icon sprite
import 'virtual:svg-icons-register';
V
vben 已提交
7

陈文彬 已提交
8
import { createApp } from 'vue';
V
vben 已提交
9
import App from './App.vue';
10
import { initAppConfigStore } from '/@/logics/initAppConfig';
11
import { setupErrorHandle } from '/@/logics/error-handle';
陈文彬 已提交
12
import router, { setupRouter } from '/@/router';
V
Vben 已提交
13
import { setupRouterGuard } from '/@/router/guard';
陈文彬 已提交
14
import { setupStore } from '/@/store';
V
vben 已提交
15
import { setupGlobDirectives } from '/@/directives';
V
vben 已提交
16 17
import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp';
V
vben 已提交
18

19 20
// Do not introduce on-demand in local development?
// In the local development for introduce on-demand, the number of browser requests will increase by about 20%.
V
Vben 已提交
21 22 23 24 25 26
// 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');
}

V
vben 已提交
27
async function bootstrap() {
28
  const app = createApp(App);
V
Vben 已提交
29

30
  // Configure store
V
Vben 已提交
31 32
  setupStore(app);

V
Vben 已提交
33
  // Initialize internal system configuration
34 35
  initAppConfigStore();

36 37
  // Register global components
  registerGlobComp(app);
V
vben 已提交
38

V
Vben 已提交
39 40 41
  // Multilingual configuration
  await setupI18n(app);

42 43
  // Configure routing
  setupRouter(app);
V
vben 已提交
44

V
Vben 已提交
45 46
  // router-guard
  setupRouterGuard();
V
vben 已提交
47

48 49
  // Register global directive
  setupGlobDirectives(app);
陈文彬 已提交
50

51 52
  // Configure global error handling
  setupErrorHandle(app);
陈文彬 已提交
53

54
  // Mount when the route is ready
V
Vben 已提交
55
  // https://next.router.vuejs.org/api/#isready
V
Vben 已提交
56
  await router.isReady();
V
vben 已提交
57

58
  app.mount('#app', true);
V
vben 已提交
59 60 61
}

void bootstrap();