Configure FIR production API defaults and environment overrides
Deploy B9 / deploy (push) Successful in 4m13s
Deploy B9 / deploy (push) Successful in 4m13s
This commit is contained in:
@@ -3,7 +3,7 @@ import { jsxLocPlugin } from "@builder.io/vite-plugin-jsx-loc";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import path from "node:path";
|
||||
import { createRequire } from "node:module";
|
||||
import { defineConfig, type Plugin } from "vite";
|
||||
import { defineConfig, loadEnv, type Plugin } from "vite";
|
||||
|
||||
const PROJECT_ROOT = import.meta.dirname;
|
||||
const require = createRequire(import.meta.url);
|
||||
@@ -52,7 +52,9 @@ const deployBase = isProd
|
||||
? (DEPLOY_ENV === "test" ? `/${DEPLOY_PROJECT}/test/legacy/` : `/${DEPLOY_PROJECT}/v2/legacy/`)
|
||||
: "/";
|
||||
|
||||
export default defineConfig({
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, PROJECT_ROOT, "");
|
||||
return {
|
||||
plugins: [firDevProxy(),legacySkipModernCssPlugin(), legacyIndexRewritePlugin(), react(), jsxLocPlugin()],
|
||||
define: {
|
||||
"import.meta.env.VITE_X9_LEGACY": JSON.stringify("1"),
|
||||
@@ -118,7 +120,7 @@ export default defineConfig({
|
||||
timeout: 0,
|
||||
proxyTimeout: 0,
|
||||
},
|
||||
"/fir-library": { target: "http://127.0.0.1:8000", changeOrigin: true, rewrite: p => p.replace(/^\/fir-library/, "/api") },
|
||||
"/fir-library": { target: env.FIR_LIBRARY_PROXY_TARGET || "https://cs-fir.luxsin.com.cn", changeOrigin: true, rewrite: p => p.replace(/^\/fir-library/, "/api") },
|
||||
"/luxsin-audio-api": {
|
||||
target: "https://api.luxsin.com.cn",
|
||||
changeOrigin: true,
|
||||
@@ -126,4 +128,5 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user