import { defineConfig } from "vite"; import uni from "@dcloudio/vite-plugin-uni"; import { resolve } from "path"; // https://vitejs.dev/config/ export default defineConfig({ plugins: [uni()], resolve: { // 配置别名 alias: { "@": resolve(__dirname, "src"), }, }, server: { proxy: { [process.env.VUE_APP_BASE_API as string]: { target: process.env.VUE_APP_API_URL, // 后端API服务器的地址 changeOrigin: true, // 是否改变源地址 rewrite: (path) => path.replace(`/^\/${process.env.VUE_APP_BASE_API}/`, ""), // 重写路径 }, }, }, });