init
This commit is contained in:
24
frontend/vite.config.js
Normal file
24
frontend/vite.config.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
server: {
|
||||
// 新增或修改 server 部分
|
||||
proxy: {
|
||||
// 关键配置:将 /api 前缀的请求代理到后端服务
|
||||
'/api': {
|
||||
// 你的 Python Flask 后端地址
|
||||
target: 'http://localhost:5000',
|
||||
|
||||
// 允许跨域
|
||||
changeOrigin: true,
|
||||
|
||||
// 可选:如果你不希望路径中保留 /api,可以重写。
|
||||
// 但根据我们的后端设计,/api 是需要的,所以不需要下面这行。
|
||||
// rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user