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
31 lines
719 B
TypeScript
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,
|
|
},
|
|
},
|
|
};
|
|
});
|