-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
83 lines (79 loc) · 1.8 KB
/
Copy pathvite.config.ts
File metadata and controls
83 lines (79 loc) · 1.8 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
74
75
76
77
78
79
80
81
82
83
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { fileURLToPath, URL } from "node:url";
export default defineConfig({
plugins: [react()],
server: {
port: 8000,
host: true,
open: false,
cors: true,
strictPort: false,
hmr: true,
proxy: {
"/api": {
target: "http://api.fanyi.baidu.com",
changeOrigin: true,
rewrite: (requestPath) => requestPath.replace(/^\/api/, ""),
},
},
},
build: {
chunkSizeWarningLimit: 2048,
reportCompressedSize: false,
assetsDir: "static",
rollupOptions: {
output: {
manualChunks(id) {
if (!id.includes("node_modules")) {
return;
}
if (id.includes("react") || id.includes("scheduler")) {
return "react-vendor";
}
if (id.includes("antd") || id.includes("@ant-design/icons")) {
return "antd-vendor";
}
if (
id.includes("zustand") ||
id.includes("axios") ||
id.includes("md5") ||
id.includes("classnames")
) {
return "utils-vendor";
}
},
chunkFileNames: "static/js/[name]-[hash].js",
entryFileNames: "static/js/[name]-[hash].js",
assetFileNames: "static/[ext]/[name]-[hash].[ext]",
},
},
minify: "terser",
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
},
},
css: {
devSourcemap: true,
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
optimizeDeps: {
include: [
"react",
"react-dom",
"antd",
"@ant-design/icons",
"zustand",
"axios",
"md5",
"classnames",
],
},
});