-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
57 lines (52 loc) · 1.38 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
/*
* @Description:
* @Author: zyg0121 [email protected]
* @Date: 2023-08-17
* @LastEditors: BG7ZAG [email protected]
* @LastEditTime: 2023-08-27
*/
import { fileURLToPath, URL } from 'node:url'
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 { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import Components from 'unplugin-vue-components/vite'
import { defineConfig } from 'vite'
const pathSrc = path.resolve(__dirname, 'src')
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
plugins: [
vue(),
vueJsx(),
Components({
resolvers: [
ElementPlusResolver({
importStyle: 'sass'
})
],
dts: path.resolve(pathSrc, 'components.d.ts')
}),
AutoImport({
// 自动导入 Vue 相关函数,如:ref, reactive, toRef 等
imports: ['vue'],
resolvers: [ElementPlusResolver()],
dts: path.resolve(pathSrc, 'auto-imports.d.ts')
})
],
server: {
proxy: {
'/v1': {
target: 'https://crac.hamcq.cn/v1',
//target: 'http://127.0.0.1:4523/m1/3178384-0-default/v1',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/v1/, '')
}
}
}
})