From 87d7ee4b0ef0078c80ae7a9b54ad066344072ffe Mon Sep 17 00:00:00 2001 From: Sebastien Bruel <93573440+sbruel@users.noreply.github.com> Date: Thu, 23 Oct 2025 05:04:49 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=90=20feat:=20Configurable=20Domain=20?= =?UTF-8?q?and=20Port=20for=20Vite=20Dev=20Server=20(#10180)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/vite.config.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/client/vite.config.ts b/client/vite.config.ts index a356e246a1..f49e6bc9cb 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -1,4 +1,5 @@ import react from '@vitejs/plugin-react'; +// @ts-ignore import path from 'path'; import type { Plugin } from 'vite'; import { defineConfig } from 'vite'; @@ -7,19 +8,23 @@ import { nodePolyfills } from 'vite-plugin-node-polyfills'; import { VitePWA } from 'vite-plugin-pwa'; // https://vitejs.dev/config/ +const backendPort = process.env.BACKEND_PORT && Number(process.env.BACKEND_PORT) || 3080; +const backendURL = process.env.HOST ? `http://${process.env.HOST}:${backendPort}` : `http://localhost:${backendPort}`; + export default defineConfig(({ command }) => ({ base: '', server: { - host: 'localhost', - port: 3090, + allowedHosts: process.env.VITE_ALLOWED_HOSTS && process.env.VITE_ALLOWED_HOSTS.split(',') || [], + host: process.env.HOST || 'localhost', + port: process.env.PORT && Number(process.env.PORT) || 3090, strictPort: false, proxy: { '/api': { - target: 'http://localhost:3080', + target: backendURL, changeOrigin: true, }, '/oauth': { - target: 'http://localhost:3080', + target: backendURL, changeOrigin: true, }, }, @@ -259,6 +264,7 @@ export default defineConfig(({ command }) => ({ interface SourcemapExclude { excludeNodeModules?: boolean; } + export function sourcemapExclude(opts?: SourcemapExclude): Plugin { return { name: 'sourcemap-exclude',