-
Notifications
You must be signed in to change notification settings - Fork 15
/
vite.config.js
47 lines (45 loc) · 1.08 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
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";
import { visualizer } from "rollup-plugin-visualizer";
const PROXY_TARGET = "http://t.weather.itboy.net/"; // 后端服务地址
export default defineConfig({
base: "/vue3-cookbook-website/",
plugins: [
vue(),
visualizer({
gzipSize: true,
brotliSize: true,
emitFile: false,
filename: "test.html", //分析图生成的文件名
open: true, //如果存在本地服务端口,将在打包后自动展示
}),
],
server: {
proxy: {
"/api": {
target: PROXY_TARGET,
changeOrigin: true,
configure: (proxy, options) => {
proxy.on("proxyRes", (proxyRes, req, res) => {
proxyRes.headers["x-proxy-url"] = PROXY_TARGET + req.originalUrl;
});
},
},
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
},
build: {
rollupOptions: {
output: {
manualChunks: {
echarts: ["echarts"],
},
},
},
},
});