配置(开发环境): 增加Vite代理以解决本地CORS

This commit is contained in:
2026-04-12 10:37:35 +08:00
parent 82c06d29fe
commit 56f94f384d
2 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -1 +1 @@
VITE_BASE_URL = 'http://localhost:5157'
VITE_BASE_URL=/api
+8 -1
View File
@@ -15,6 +15,13 @@ export default defineConfig({
},
server: {
host: '0.0.0.0',
port: 5158
port: 5158,
proxy: {
"/api": {
target: "http://localhost:5157",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
}
})