-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
59 lines (58 loc) · 1.54 KB
/
vite.config.js
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
import { defineConfig } from 'vite'; //增加配置
import vue from '@vitejs/plugin-vue'
import vitePluginImport from 'vite-plugin-babel-import';
import styleImport from 'vite-plugin-style-import';
import path from 'path';
import alias from "@rollup/plugin-alias";
import resolve from "rollup-plugin-node-resolve";
// 项目基础url
const baseUrl ={
development:'./',
beta:'./',
release:'./'
}
// 配置 vite
export default ({mode}) => defineConfig({
css: {
preprocessorOptions: {
less: {
// javascriptEnabled: true,
additionalData: `@import "src/common/css/mixin.less";`
},
},
},
plugins:[
alias(),
vue(),
styleImport({
libs: [
{
libraryName: 'vant',
esModule: true,
resolveStyle: (name) => {
return `vant/es/${name}/style`;
},
},
],
}),
],
base: baseUrl[mode],
resolve:{
alias:{
'~': path.resolve(__dirname, './'),
'@': path.resolve(__dirname, 'src')
}
},
server: {
// 设置接口代理
proxy: {
'/api': {
target: 'http://mobile.seantao5.xyz/server/api/v1/api/app',
// target: 'http://127.0.0.1:4002/v1/api/app',
// target: 'http://backend-api-01.newbee.ltd/api/v1',
changeOrigin: true,
rewrite: path => path.replace(/^\/api/, '')
}
}
}
})