diff --git a/vite.config.js b/vite.config.js index ce41df4..990925e 100755 --- a/vite.config.js +++ b/vite.config.js @@ -2,12 +2,17 @@ import { defineConfig, loadEnv } from 'vite' import react from '@vitejs/plugin-react' import { getConnectableHost, normalizeLoopbackHost } from './shared/networkHosts.js' -export default defineConfig(({ command, mode }) => { +export default defineConfig(({ mode }) => { // Load env file based on `mode` in the current working directory. const env = loadEnv(mode, process.cwd(), '') const configuredHost = env.HOST || '0.0.0.0' + // if the host is not a loopback address, it should be used directly. + // This allows the vite server to EXPOSE all interfaces when the host + // is set to '0.0.0.0' or '::', while still using 'localhost' for browser + // URLs and proxy targets. const host = normalizeLoopbackHost(configuredHost) + const proxyHost = getConnectableHost(configuredHost) const serverPort = env.SERVER_PORT || 3001