| 123456789101112131415161718192021222324 |
- import { defineConfig } from "vite";
- import react from "@vitejs/plugin-react";
- // BASE_PATH: 生产环境通过 nginx /ads/ 子路径代理时设为 "/ads/"
- // 本地开发默认 "/",也可通过环境变量覆盖:BASE_PATH=/ads/ npm run dev
- const BASE = process.env.BASE_PATH || "/";
- export default defineConfig({
- base: BASE,
- plugins: [react()],
- server: {
- port: 9527,
- proxy: {
- "/api": {
- target: "http://localhost:3001",
- changeOrigin: true,
- },
- "/q": {
- target: "http://localhost:3001",
- changeOrigin: true,
- },
- },
- },
- });
|