forked from baron/baron-sso
devfront 구동 검증
This commit is contained in:
@@ -1,11 +1,50 @@
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { defineConfig } from "vite";
|
||||
|
||||
const buildOutDir =
|
||||
process.env.DEVFRONT_BUILD_OUT_DIR ?? "/tmp/baron-sso-devfront-dist";
|
||||
|
||||
const defaultAllowedHosts = [
|
||||
"sdev.hmac.kr",
|
||||
"localhost",
|
||||
"172.16.10.176",
|
||||
"127.0.0.1",
|
||||
];
|
||||
|
||||
function hostFromUrl(value: string | undefined) {
|
||||
if (!value) return undefined;
|
||||
try {
|
||||
return new URL(value).hostname;
|
||||
} catch {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
const allowedHosts = Array.from(
|
||||
new Set(
|
||||
[
|
||||
...defaultAllowedHosts,
|
||||
hostFromUrl(process.env.DEVFRONT_URL),
|
||||
...(process.env.DEVFRONT_ALLOWED_HOSTS ?? "")
|
||||
.split(",")
|
||||
.map((host) => host.trim())
|
||||
.filter(Boolean),
|
||||
].filter((host): host is string => Boolean(host)),
|
||||
),
|
||||
);
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
cacheDir:
|
||||
process.env.DEVFRONT_VITE_CACHE_DIR ??
|
||||
"/tmp/baron-sso-devfront-vite-cache",
|
||||
build: {
|
||||
outDir: buildOutDir,
|
||||
emptyOutDir: true,
|
||||
},
|
||||
server: {
|
||||
host: "127.0.0.1",
|
||||
allowedHosts: ["sdev.hmac.kr", "localhost", "172.16.10.176", "127.0.0.1"],
|
||||
allowedHosts,
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: process.env.API_PROXY_TARGET || "http://localhost:3000",
|
||||
@@ -16,7 +55,7 @@ export default defineConfig({
|
||||
preview: {
|
||||
host: "127.0.0.1",
|
||||
port: 5173,
|
||||
allowedHosts: ["sdev.hmac.kr", "localhost", "172.16.10.176", "127.0.0.1"],
|
||||
allowedHosts,
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: process.env.API_PROXY_TARGET || "http://localhost:3000",
|
||||
|
||||
Reference in New Issue
Block a user