/
vite.config.ts
41 lines (40 loc) · 959 Bytes
/
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
import { resolve } from 'path';
import vue from '@vitejs/plugin-vue';
import { defineConfig } from 'vite';
import vitePluginImp from 'vite-plugin-imp';
export default defineConfig({
plugins: [
vue(),
// vitePluginImp({
// libList: [
// {
// libName: 'vant',
// style(name) {
// return `vant/lib/index.css`
// },
// },
// ],
// }),
],
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
comps: resolve(__dirname, 'src/components'),
},
},
base: './',
server: {
port: 4000, // 设置端口
open: true, // 设置启动时,自动打开浏览器
cors: true, // 允许跨域
proxy: {
//设置代理,根据我们项目实际情况配置
'/api': {
target: 'https://jk-hs.com/yygh',
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace('/api/', '/'),
},
},
},
});