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

23 lines
604 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url'
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/, '')
}
}
}
})