build(vite):调整反代配置。

This commit is contained in:
徐涛 2024-04-05 10:23:58 +08:00
parent 46396e7d6f
commit 19e0c1fa7c

View File

@ -5,13 +5,12 @@ import { defineConfig } from "vite";
export default defineConfig({ export default defineConfig({
plugins: [react()], plugins: [react()],
server: { server: {
port: 3000,
proxy: { proxy: {
"/api": { "/api": {
target: `http://127.0.0.1:3000`, target: `http://127.0.0.1:8080`,
changeOrigin: true, changeOrigin: true,
secure: false, secure: false,
rewrite: (path) => path.replace(/^\/api/, proxyHost.Path), rewrite: (path) => path.replace(/^\/api/, ""),
}, },
}, },
}, },