import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; // https://vite.dev/config/ export default defineConfig({ plugins: [react()], server: { // 监听所有IP地址 host: "0.0.0.0", // 指定dev sever的端口号 port: 3000, // 自动打开浏览器运行以下页面 open: "/", // 设置反向代理 proxy: { // 以下示例表示:请求URL中含有"/api",则反向代理到http://localhost // 例如: http://localhost:3000/api/login -> http://localhost/api/login "/api": { target: "http://localhost:5000/", changeOrigin: true, }, }, }, });