-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
54 lines (53 loc) · 1.19 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
44
45
46
47
48
49
50
51
52
53
54
import react from "@vitejs/plugin-react";
import path from "path";
import { defineConfig } from "vite";
import vitePluginImp from "vite-plugin-imp";
import svgrPlugin from "vite-plugin-svgr";
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
"@": path.join(__dirname, "src"),
},
},
server: {
port: 8889,
proxy: {
"/api": {
target: "http://localhost:8080", // 确保这是你想要代理到的后端服务器
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
},
plugins: [
react({
jsxImportSource: "@emotion/react",
babel: {
plugins: ["@emotion/babel-plugin"],
},
}),
vitePluginImp({
libList: [
{
libName: "antd",
style: (name) => `antd/es/${name}/style/index`,
},
{
libName: "lodash",
libDirectory: "",
camel2DashComponentName: false,
style: () => {
return false;
},
},
],
}),
svgrPlugin({
svgrOptions: {
icon: true,
// ...svgr options (https://react-svgr.com/docs/options/)
},
}),
],
});