import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' // ==================== 配置说明 ==================== // 1. 本地开发(Java在本机): target 设为 'http://localhost:8086' // 2. 远程服务器: target 设为 'http://服务器IP:8086' // // 修改下方 API_SERVER 变量即可切换 const API_SERVER = process.env.API_SERVER || 'http://192.168.2.3:18520' export default defineConfig({ plugins: [vue()], server: { port: 5173, host: true, // 允许局域网访问 proxy: { '/api': { target: API_SERVER, changeOrigin: true, secure: false }, '/auth': { target: API_SERVER, changeOrigin: true, secure: false } } }, resolve: { alias: { '@': '/src' } } })