import { defineConfig } from "vite"; import uni from "@dcloudio/vite-plugin-uni"; /** 与 src/utils/apiBase.ts 中 US_BACKEND_ORIGIN_FALLBACK 保持一致 */ const US_DEV_BACKEND = "http://flus-test.3ffoodsafety.com"; // 仅 App:相对路径,避免打包后 www/_uniappview.html 无法打开 // https://vitejs.dev/config/ export default defineConfig({ base: "./", plugins: [uni()], server: { open: "/", proxy: { "/api": { target: US_DEV_BACKEND, changeOrigin: true, }, /** 若某处仍使用相对路径 /picture(未走 getStaticMediaOrigin),可经代理访问后端静态资源 */ "/picture": { target: US_DEV_BACKEND, changeOrigin: true, }, }, }, });