-
Notifications
You must be signed in to change notification settings - Fork 5
/
vite.config.ts
99 lines (97 loc) · 2.8 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import vueI18n from '@intlify/vite-plugin-vue-i18n';
import legacy from '@vitejs/plugin-legacy';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
import path from 'path';
import AutoImport from 'unplugin-auto-import/vite';
import IconsResolver from 'unplugin-icons/resolver';
import Icons from 'unplugin-icons/vite';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
import Components from 'unplugin-vue-components/vite';
import type { UserConfigExport } from 'vite';
import eslintPlugin from 'vite-plugin-eslint';
import html from 'vite-plugin-html';
import Inspect from 'vite-plugin-inspect';
import vueSetupExtend from 'vite-plugin-vue-setup-extend';
import svgLoader from 'vite-svg-loader';
function resolve(dir: string) {
return path.join(__dirname, dir);
}
// https://vitejs.dev/config/
export default function (): UserConfigExport {
return {
server: {
host: '0.0.0.0', // 解决不能通过ip访问
proxy: {
'/api': 'http://api.beehub.paradeum.com:8110',
'/static': 'http://api.beehub.paradeum.com:8110'
}
},
css: {
preprocessorOptions: {
scss: {
// 自定义的主题色
additionalData: `@use "@/styles/element/index.scss" as *;`
}
}
},
plugins: [
vueSetupExtend(),
html({
inject: {
data: {
title: 'KuggaMax'
}
},
minify: true
}),
Icons({
autoInstall: true
}),
svgLoader({
defaultImport: 'raw' // or 'url'
}),
Inspect(),
vueI18n({
// if you want to use Vue I18n Legacy API, you need to set `compositionOnly: false`
// you need to set i18n resource including paths !
include: resolve('./src/i18n/**')
}),
AutoImport({
resolvers: [ElementPlusResolver()],
eslintrc: {
enabled: true, // Default `false`
filepath: './.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json`
globalsPropValue: true // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
},
imports: ['vue', 'vue-router', 'vuex', 'vue-i18n'],
dts: resolve('src/auto-imports.d.ts')
}),
Components({
extensions: ['vue', 'tsx'],
resolvers: [
// Auto register icon components
// 自动注册图标组件
IconsResolver({
enabledCollections: ['ep']
}),
ElementPlusResolver()
],
dts: resolve('src/components.d.ts')
}),
vue(),
vueJsx(),
eslintPlugin({
fix: true
}),
legacy({
targets: ['defaults', 'not IE 11']
})
],
resolve: {
alias: {
'@': resolve('./src')
}
}
};
}