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