CD配唱片
2025-05-07 4079d1c5a3efb6b31879d9f80dd067cc01b11e91
vite.config.js
@@ -14,49 +14,49 @@
  const { VITE_APP_ENV, VITE_APP_BASE_API } = env;
  console.log(VITE_APP_BASE_API, VITE_APP_ENV);
  // 根据环境变量动态设置代理
  const proxyConfig = () => {
    const personProxy = {
      "/prod-api": {
        target: "http://192.168.50.160:8080",//"http://192.168.50.13:8080", // 开发环境的后端地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/prod-api/, ""),
      },
    };
    const devProxy = {
      "/prod-api": {
        target: "http://192.168.50.160:8080", // 开发环境的后端地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/prod-api/, ""),
      },
    };
  // const proxyConfig = () => {
  //   const personProxy = {
  //     "/prod-api": {
  //       target: "http://192.168.50.160:8080",//"http://192.168.50.13:8080", // 开发环境的后端地址
  //       changeOrigin: true,
  //       rewrite: (path) => path.replace(/^\/prod-api/, ""),
  //     },
  //   };
  //   const devProxy = {
  //     "/prod-api": {
  //       target: "http://192.168.50.160:8080", // 开发环境的后端地址
  //       changeOrigin: true,
  //       rewrite: (path) => path.replace(/^\/prod-api/, ""),
  //     },
  //   };
    const testProxy = {
      "/prod-api": {
        target: "http://192.168.50.160:8080", // 测试环境的后端地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/prod-api/, ""),
      },
    };
  //   const testProxy = {
  //     "/prod-api": {
  //       target: "http://192.168.50.160:8080", // 测试环境的后端地址
  //       changeOrigin: true,
  //       rewrite: (path) => path.replace(/^\/prod-api/, ""),
  //     },
  //   };
    const prodProxy = {
      "/prod-api": {
        target: "http://192.168.50.160:8080", // 测试环境的后端地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/prod-api/, ""),
      },
    };
  //   const prodProxy = {
  //     "/prod-api": {
  //       target: "http://192.168.50.160:8080", // 测试环境的后端地址
  //       changeOrigin: true,
  //       rewrite: (path) => path.replace(/^\/prod-api/, ""),
  //     },
  //   };
    switch (VITE_APP_ENV) {
      case "development":
        return personProxy;
      case "int":
        return devProxy;
      case "uat":
        return testProxy;
      default: // 默认开发环境
        return prodProxy;
    }
  };
  //   switch (VITE_APP_ENV) {
  //     case "development":
  //       return personProxy;
  //     case "int":
  //       return devProxy;
  //     case "uat":
  //       return testProxy;
  //     default: // 默认开发环境
  //       return prodProxy;
  //   }
  // };
  return {
    // 部署生产环境和开发环境下的URL。
    // 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上
@@ -79,7 +79,13 @@
      port: 80,
      host: true,
      open: true,
      proxy: proxyConfig(),
      proxy: {
        "/prod-api": {
          target: "http://192.168.50.160:8080", // 测试环境的后端地址
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/prod-api/, ""),
        },
      },
    },
    //fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file
    css: {