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