vben
authored
4 years ago
1
import '/@/design/index.less';
Vben
authored
4 years ago
2
import 'virtual:windi.css';
vben
authored
4 years ago
3
4
import { createApp } from 'vue';
vben
authored
5 years ago
5
import App from './App.vue';
Vben
authored
4 years ago
6
import { initAppConfigStore } from '/@/logics/initAppConfig';
7
import router, { setupRouter } from '/@/router';
Vben
authored
4 years ago
8
import { setupRouterGuard } from '/@/router/guard';
9
import { setupStore } from '/@/store';
vben
authored
5 years ago
10
import { setupErrorHandle } from '/@/logics/error-handle';
vben
authored
5 years ago
11
import { setupGlobDirectives } from '/@/directives';
vben
authored
5 years ago
12
13
import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp';
vben
authored
5 years ago
14
Vben
authored
4 years ago
15
// Register icon Sprite
Vben
authored
4 years ago
16
17
import 'vite-plugin-svg-icons/register';
Vben
authored
4 years ago
18
19
20
21
22
23
24
25
// Do not introduce` on-demand in local development?
// In the local development for on-demand introduction, the number of browser requests will increase by about 20%.
// 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
27
(async () => {
const app = createApp(App);
Vben
authored
4 years ago
28
29
30
31
// Configure vuex store
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
5 years ago
43
Vben
authored
4 years ago
44
45
// router-guard
setupRouterGuard();
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
61
if (import.meta.env.DEV) {
window.__APP__ = app;
}
Vben
authored
4 years ago
62
})();