-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
67 lines (59 loc) · 1.44 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
60
61
62
63
64
65
66
67
import { loadEnv } from 'vite';
import { viteMockServe } from 'vite-plugin-mock';
import { createVuePlugin } from 'vite-plugin-vue2';
import { createSvgPlugin } from 'vite-plugin-vue2-svg';
import electron from 'vite-plugin-electron';
import path from 'path';
const CWD = process.cwd();
export default ({ mode }) => {
const { VITE_BASE_URL } = loadEnv(mode, CWD);
return {
base: VITE_BASE_URL,
resolve: {
alias: {
'~': path.resolve(__dirname, './'),
'@': path.resolve(__dirname, './src'),
},
},
css: {
preprocessorOptions: {
less: {
modifyVars: {},
},
},
},
plugins: [
createVuePlugin({
jsx: true,
}),
viteMockServe({
mockPath: 'mock',
localEnabled: true,
}),
createSvgPlugin(),
electron({
main: {
entry: 'electron/main/index.ts', // 主进程文件
},
preload: {
input: path.join(__dirname, 'electron/preload/index.ts'), // 预加载文件
},
}),
],
build: {
cssCodeSplit: false,
},
server: {
host: '0.0.0.0',
port: 3001,
proxy: {
'/api': {
// 用于开发环境下的转发请求
// 更多请参考:https://vitejs.dev/config/#server-proxy
target: 'https://service-exndqyuk-1257786608.gz.apigw.tencentcs.com',
changeOrigin: true,
},
},
},
};
};