-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.config.ts
More file actions
65 lines (63 loc) · 1.68 KB
/
vite.config.ts
File metadata and controls
65 lines (63 loc) · 1.68 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
import { defineConfig } from "vite";
import path from "path";
import vue from "@vitejs/plugin-vue";
//SVG插件
import { createSvgIconsPlugin } from "vite-plugin-svg-icons-ng";
export default defineConfig({
plugins: [
vue(),
createSvgIconsPlugin({
// 指定需要缓存的图标文件夹
iconDirs: [path.resolve(process.cwd(), "src/assets/icons")],
// 指定symbolId格式
symbolId: "icon-[dir]-[name]",
/**
// * custom insert position
// * @default: body-last
// */
inject: "body-last",
// /**
// * custom dom id
// * @default: __svg__icons__dom__
// */
customDomId: "__svg__icons__dom__",
}),
],
resolve: {
alias: {
"@": path.resolve("./src"),
},
},
server: {
proxy: {
"/api": {
target: "http://127.0.0.1:8080",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
configure: (proxy) => {
proxy.on("proxyRes", (proxyRes) => {
// SSE 流式响应需要禁用压缩和缓冲
if (proxyRes.headers["content-type"] === "text/event-stream") {
delete proxyRes.headers["content-encoding"];
proxyRes.headers["cache-control"] = "no-cache";
proxyRes.headers["x-accel-buffering"] = "no";
}
});
},
},
},
},
css: {
preprocessorOptions: {
less: {
//你的less文件 地址
additionalData: `
@import "@/styles/variables.less";
@import "@/styles/scrollBar.less";
`,
// @import "@/assets/styles/mixins.less";
javascriptEnabled: true,
},
},
},
});