Files
KCGL/inventory-web/vite.config.ts

23 lines
604 B
TypeScript
Raw Normal View History

2026-01-26 13:47:53 +08:00
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url'
2026-01-26 13:47:53 +08:00
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
// --- 新增下面这一段 server 配置 ---
server: {
proxy: {
'/api': {
target: 'http://127.0.0.1:5000', // 后端的地址
changeOrigin: true,
// 如果你的后端路径本身就包含 /api,通常不需要 rewrite
// rewrite: (path) => path.replace(/^\/api/, '')
}
}
}
})