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
Vben
authored
4 years ago
4
// Do not introduce` on-demand in local development?
Vben
authored
4 years ago
5
6
7
8
9
10
11
// 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');
}
12
import { createApp } from 'vue';
vben
authored
5 years ago
13
import App from './App.vue';
vben
authored
5 years ago
14
15
16
import router, { setupRouter } from '/@/router';
import { setupStore } from '/@/store';
vben
authored
5 years ago
17
import { setupErrorHandle } from '/@/logics/error-handle';
vben
authored
5 years ago
18
import { setupGlobDirectives } from '/@/directives';
vben
authored
5 years ago
19
20
import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp';
vben
authored
5 years ago
21
Vben
authored
4 years ago
22
23
24
// router-guard
import '/@/router/guard';
Vben
authored
4 years ago
25
// Register icon Sprite
Vben
authored
4 years ago
26
27
import 'vite-plugin-svg-icons/register';
vben
authored
5 years ago
28
import { isDevMode } from '/@/utils/env';
vben
authored
5 years ago
29
Vben
authored
4 years ago
30
31
32
33
(async () => {
const app = createApp(App);
// Register global components
registerGlobComp(app);
vben
authored
5 years ago
34
Vben
authored
4 years ago
35
36
// Multilingual configuration
await setupI18n(app);
Vben
authored
4 years ago
37
Vben
authored
4 years ago
38
39
// Configure routing
setupRouter(app);
vben
authored
5 years ago
40
Vben
authored
4 years ago
41
42
// Configure vuex store
setupStore(app);
vben
authored
5 years ago
43
Vben
authored
4 years ago
44
45
// Register global directive
setupGlobDirectives(app);
46
Vben
authored
4 years ago
47
48
// Configure global error handling
setupErrorHandle(app);
49
Vben
authored
4 years ago
50
51
// Mount when the route is ready
await router.isReady();
vben
authored
5 years ago
52
vben
authored
5 years ago
53
app.mount('#app', true);
54
Vben
authored
4 years ago
55
56
// The development environment takes effect
if (isDevMode()) {
Vben
authored
4 years ago
57
// app.config.performance = true;
Vben
authored
4 years ago
58
59
60
window.__APP__ = app;
}
})();