Allow deployed frontend host

This commit is contained in:
masterdev
2026-06-16 22:53:38 +01:00
parent a93bc585e7
commit 9f2aeb1d4e
3 changed files with 22 additions and 7 deletions

View File

@@ -1,10 +1,19 @@
import { defineConfig } from "vite";
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react-swc";
export default defineConfig({
plugins: [react()],
server: {
host: "0.0.0.0",
port: 5173,
},
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
const allowedHosts = (env.VITE_ALLOWED_HOSTS ?? "localhost,127.0.0.1,plasttrack.sable.ynsdev.site")
.split(",")
.map((host) => host.trim())
.filter(Boolean);
return {
plugins: [react()],
server: {
host: "0.0.0.0",
port: 5173,
allowedHosts,
},
};
});