langflow/src/frontend/vite.config.ts
anovazzi1 a47dc9ae92 feat(frontend): add support for updating node template on code change in CodeAreaModal
fix(API): fix UpdateTemplate function return type to match the actual response
fix(vite.config.ts): add dynamic_node route to apiRoutes array to proxy requests to backend
2023-06-22 17:30:04 -03:00

31 lines
719 B
TypeScript

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import svgr from "vite-plugin-svgr";
const apiRoutes = ["^/api/v1/", "/health","/dynamic_node"];
// Use environment variable to determine the target.
const target = process.env.VITE_PROXY_TARGET || "http://127.0.0.1:7860";
const proxyTargets = apiRoutes.reduce((proxyObj, route) => {
proxyObj[route] = {
target: target,
changeOrigin: true,
secure: false,
ws: true,
};
return proxyObj;
}, {});
export default defineConfig(() => {
return {
build: {
outDir: "build",
},
plugins: [react(), svgr()],
server: {
port: 3000,
proxy: {
...proxyTargets,
},
},
};
});