37 lines
714 B
TypeScript
37 lines
714 B
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
|
|
const serverRoutes = [
|
|
"/access",
|
|
"/buy/start",
|
|
"/buy/complete",
|
|
"/buy/cancel",
|
|
"/session",
|
|
"/tokens",
|
|
"/invoice",
|
|
];
|
|
const baseServerConfigBuilder = (domain: string) => ({
|
|
proxy: Object.fromEntries(
|
|
serverRoutes.map((key) => [
|
|
key,
|
|
{
|
|
target: `http://${domain}:3000`,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
},
|
|
]),
|
|
),
|
|
port: 8000,
|
|
strictPort: true,
|
|
});
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
server: {
|
|
...baseServerConfigBuilder("localhost"),
|
|
host: true,
|
|
},
|
|
preview: baseServerConfigBuilder("paysplit-app"),
|
|
plugins: [react()],
|
|
});
|