forked from frontend-winter/react-admin-vite-antd5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
43 lines (41 loc) · 1.07 KB
/
vite.config.ts
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
import legacy from "@vitejs/plugin-legacy";
import react from "@vitejs/plugin-react";
import { fileURLToPath } from "url";
import { defineConfig } from "vite";
// https://vitejs.dev/config/
import vitePluginCompression from "vite-plugin-compression";
const baseUrl = "react-admin-vite-antd5";
export default defineConfig(config => {
console.log(config, "config");
return {
plugins: [
legacy(),
react(),
vitePluginCompression({
threshold: 1024 * 10, // 对大于 10kb 的文件进行压缩
// deleteOriginFile: true,
}),
],
resolve: {
alias: {
// for TypeScript path alias import like : @/x/y/z
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
server: {
open: true,
port: 5793,
proxy: {
"/api": {
target: "http://localhost:8080",
secure: false,
rewrite: path => path.replace(/^\/api/, ""),
},
},
},
base: config.mode === "development" ? "/" : `/${baseUrl}/`,
build: {
outDir: baseUrl,
},
};
});