-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
73 lines (71 loc) · 2 KB
/
Copy pathvite.config.js
File metadata and controls
73 lines (71 loc) · 2 KB
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
import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";
// Buid for PublicPath : https://v2.vitejs.dev/guide/build.html#public-base-path
// https://vitejs.dev/config/
export default ({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
return defineConfig({
plugins: [vue()],
/* optimizeDeps: {
exclude: ["js-big-decimal"],
}, */
build: {
minify: "esbuild",
chunkSizeWarningLimit: 1600,
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes("node_modules")) {
return id
.toString()
.split("node_modules/")[1]
.split("/")[0]
.toString();
}
},
},
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
"~bootstrap": path.resolve(__dirname, "node_modules/bootstrap"),
},
},
server: {
port: 8080,
proxy: {
"^/api1/.*": {
target: process.env.VITE_APP_ONE_API,
changeOrigin: true,
secure: false,
ws: true,
rewrite: (path) => path.replace(/^\/api1/, ""),
},
"^/api2/.*": {
target: process.env.VITE_APP_THREE_API,
changeOrigin: true,
secure: false,
ws: true,
rewrite: (path) => path.replace(/^\/api2/, ""),
configure: (proxy, _options) => {
proxy.on("error", (err, _req, _res) => {
console.log("proxy error", err);
});
proxy.on("proxyReq", (proxyReq, req, _res) => {
console.log("Sending Request to :", req.method, req.url);
});
proxy.on("proxyRes", (proxyRes, req, _res) => {
console.log(
"Received Response from :",
proxyRes.statusCode,
req.url
);
});
},
},
},
},
});
};