29 lines
		
	
	
		
			647 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			647 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { defineConfig } from "vite"
 | ||
| import vue from "@vitejs/plugin-vue"
 | ||
| import tailwindcss from '@tailwindcss/vite'
 | ||
| import path from 'path'
 | ||
| 
 | ||
| // https://vite.dev/config/
 | ||
| export default defineConfig({
 | ||
|   plugins: [
 | ||
|     vue(), 
 | ||
|     tailwindcss(),
 | ||
|   ],
 | ||
|   resolve: {
 | ||
|     // 使用别名
 | ||
|     alias: {
 | ||
|       "@": path.resolve(__dirname, "./src"),
 | ||
|     },
 | ||
|   },
 | ||
|   server: {
 | ||
|     proxy: {
 | ||
|       // 将 /api 前缀的请求代理到 Beego 后端(默认端口 8080)
 | ||
|       "/api": {
 | ||
|         target: process.env.VITE_API_BASE_URL,
 | ||
|         changeOrigin: true,
 | ||
|         // 不需要去掉 /api 前缀,因为 Beego 路由已包含 /api
 | ||
|       },
 | ||
|     },
 | ||
|   },
 | ||
| });
 |