28 lines
903 B
TypeScript
28 lines
903 B
TypeScript
import { fileURLToPath } from "node:url";
|
|
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import { defineConfig, loadEnv } from "vite";
|
|
|
|
import { createBackendProxy } from "./config/backend-proxy.ts";
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
// Read this project's configuration; the repository .env contains server secrets.
|
|
const env = loadEnv(mode, process.cwd(), "S2S_");
|
|
return {
|
|
plugins: [react(), tailwindcss()],
|
|
resolve: { alias: { "@": fileURLToPath(new URL("./src", import.meta.url)) } },
|
|
server: {
|
|
host: "127.0.0.1",
|
|
port: 5173,
|
|
strictPort: true,
|
|
allowedHosts: (env.S2S_DEV_ALLOWED_HOSTS ?? "")
|
|
.split(",")
|
|
.map((host) => host.trim())
|
|
.filter(Boolean),
|
|
proxy: createBackendProxy(env.S2S_BACKEND_URL ?? "http://127.0.0.1:8420"),
|
|
},
|
|
build: { target: "es2022" },
|
|
};
|
|
});
|