-
Notifications
You must be signed in to change notification settings - Fork 9
/
vite.config.ts
92 lines (82 loc) · 2.77 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
import { resolve } from 'path'
import { defineConfig, UserConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import jsx from '@vitejs/plugin-vue-jsx'
// https://vitejs.dev/config/
// export default defineConfig({
export default defineConfig((config: UserConfig) => {
return {
plugins: [
vue({
// https://cn.vuejs.org/guide/extras/reactivity-transform.html#explicit-opt-in
reactivityTransform: true
}),
jsx({
transformOn: true,
mergeProps: true,
})
],
base: './',
define: {
'process.env': {}
},
// mode: (config.mode || process.env.NODE_ENV),
// publicDir: 'public',
// cacheDir: 'node_modules/.vite',
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
},
extensions: ['.js', '.jsx', '.ts', '.tsx', 'css', 'less', '.json', '.vue', '*']
},
css: {
preprocessorOptions: {
less: {
modifyVars: {
/* 默认样式,【注:这里是用作于全局antdv样式,可自定义修改哦!注:当使用antd.variable.min.css时,这里的设置是无效的哦!】
* https://www.antdv.com/docs/vue/customize-theme-cn
'primary-color': `#1890ff`, // 全局主色
'link-color': `#1890ff`, // 链接色
'success-color': `#52c41a`, // 成功色
'warning-color': `#faad14`, // 警告色
'error-color': `#f5222d`, // 错误色
'font-size-base': `14px`, // 主字号
'heading-color': `rgba(0, 0, 0, 0.85)`, // 标题色
'text-color': `rgba(0, 0, 0, 0.65)`, // 主文本色
'text-color-secondary': `rgba(0, 0, 0, 0.45)`, // 次文本色
'disabled-color': `rgba(0, 0, 0, 0.25)`, // 失效色
'border-radius-base': `4px`, // 组件/浮层圆角
'border-color-base': ` #d9d9d9`, // 边框色
'box-shadow-base': `0 2px 8px rgba(0, 0, 0, 0.15)`, // 浮层阴影
*
*/
},
javascriptEnabled: true
}
}
},
server: {
host: true,
port: 666,
strictPort: 888,
open: true,
https: false,
proxy: {
'/api': {
target: 'https://www.xxx.com',
cors: true,
changeOrigin: true,
rewrite(path) {
return path.replace(/^\/api/, '')
},
}
}
},
build: {
outDir: 'dist', // export path
target: 'modules',
assetsDir: 'assets',
assetsInlineLimit: 360000 // 360kb
}
}
});