-
Notifications
You must be signed in to change notification settings - Fork 5
/
vite.config.js
37 lines (36 loc) · 882 Bytes
/
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
import { defineConfig, loadEnv } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import pkg from "./package.json";
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, __dirname);
// console.log(env);
return {
build: {
minify: "terser",
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
},
},
define: {
__APP_INFO__: JSON.stringify({
pkg,
buildTimestamp: Date.now(),
}),
},
plugins: [uni()],
server: {
port: Number.parseInt(env.VITE_APP_PORT, 10),
proxy: {
[env.VITE_APP_PROXY_PREFIX]: {
changeOrigin: true,
target: env.VITE_APP_BASE_URL,
rewrite: (path) =>
path.replace(new RegExp("^" + env.VITE_APP_PROXY_PREFIX), ""),
},
},
},
};
});