import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' // https://vite.dev/config/ export default defineConfig({ plugins: [vue()], server: { host: '0.0.0.0', // 允许局域网访问 port: 5173, strictPort: true, // ✅ 强制使用指定端口,如果被占用则报错而不是自动切换 proxy: { '/api': { target: 'http://localhost:8888', changeOrigin: true, secure: false, }, }, }, })