Blame view

src/main.ts 1.63 KB
vben authored
1
import '/@/design/index.less';
2
import '/@/design/tailwind.css';
3
4
// Register icon sprite
import 'virtual:svg-icons-register';
vben authored
5
import App from './App.vue';
Vben authored
6
import { createApp } from 'vue';
7
import { initAppConfigStore } from '/@/logics/initAppConfig';
8
import { setupErrorHandle } from '/@/logics/error-handle';
Vben authored
9
import { router, setupRouter } from '/@/router';
Vben authored
10
import { setupRouterGuard } from '/@/router/guard';
陈文彬 authored
11
import { setupStore } from '/@/store';
vben authored
12
import { setupGlobDirectives } from '/@/directives';
vben authored
13
14
import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp';
vben authored
15
16
17
// 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%.
18
19
20
21
22
23
// 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');
}
vben authored
24
async function bootstrap() {
25
  const app = createApp(App);
Vben authored
26
27
  // Configure store
Vben authored
28
29
  setupStore(app);
30
  // Initialize internal system configuration
31
32
  initAppConfigStore();
33
34
  // Register global components
  registerGlobComp(app);
vben authored
35
Vben authored
36
37
38
  // Multilingual configuration
  await setupI18n(app);
39
40
  // Configure routing
  setupRouter(app);
vben authored
41
Vben authored
42
  // router-guard
43
  setupRouterGuard(router);
vben authored
44
45
46
  // Register global directive
  setupGlobDirectives(app);
陈文彬 authored
47
48
49
  // Configure global error handling
  setupErrorHandle(app);
陈文彬 authored
50
51
  // Mount when the route is ready
Vben authored
52
  // https://next.router.vuejs.org/api/#isready
Vben authored
53
  await router.isReady();
vben authored
54
55
  app.mount('#app', true);
vben authored
56
57
58
}

void bootstrap();