You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
882 B
38 lines
882 B
import reactRefresh from "@vitejs/plugin-react-refresh";
|
|
import { resolve } from "path";
|
|
import { defineConfig } from "vite";
|
|
import dynamicApp from "./dynamicApp";
|
|
|
|
const app = process.env.APP;
|
|
|
|
if (!app || (app !== "maker" && app !== "taker")) {
|
|
throw new Error("APP environment variable needs to be set to `maker` `taker`");
|
|
}
|
|
|
|
const backendPorts = {
|
|
"taker": 8000,
|
|
"maker": 8001,
|
|
};
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
(
|
|
process.env.NODE_ENV !== "test"
|
|
? [reactRefresh()]
|
|
: []
|
|
),
|
|
dynamicApp(app),
|
|
],
|
|
build: {
|
|
rollupOptions: {
|
|
input: resolve(__dirname, `index.html`),
|
|
},
|
|
outDir: `dist/${app}`,
|
|
},
|
|
server: {
|
|
proxy: {
|
|
"/api": `http://localhost:${backendPorts[app]}`,
|
|
},
|
|
},
|
|
});
|
|
|