-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
45 lines (45 loc) · 1.15 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
import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";
import viteCompression from "vite-plugin-compression";
import ElementPlus from 'unplugin-element-plus/vite';
import electron from "vite-plugin-electron";
import renderer from 'vite-plugin-electron-renderer'
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
const env = loadEnv(mode, process.cwd());
return {
plugins: [
vue(),
viteCompression({
verbose: true,
disable: false,
threshold: 10240,
algorithm: "gzip",
ext: ".gz",
}),
ElementPlus(),
electron({
entry: 'electron/main/index.js',
}),
renderer(),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
"/images": "src/assets/images",
},
},
server: {
open: false,
port: 3004,
proxy: {
"/api": {
target: env.VITE_APP_API_BASEURL,
changeOrigin: command === "serve" && env.VITE_OPEN_PROXY == "true",
rewrite: (path) => path.replace(/^\/api/, '')
},
},
},
};
});