diff --git a/docker-compose-light.yml b/docker-compose-light.yml index 1910699be4a..b06be681af3 100644 --- a/docker-compose-light.yml +++ b/docker-compose-light.yml @@ -162,8 +162,11 @@ services: SCARF_ANALYTICS: "${SCARF_ANALYTICS:-}" # configuring the dev-server to use the host.docker.internal to connect to the backend superset: "http://superset-light:8088" + # Webpack dev server configuration + WEBPACK_DEVSERVER_HOST: "${WEBPACK_DEVSERVER_HOST:-127.0.0.1}" + WEBPACK_DEVSERVER_PORT: "${WEBPACK_DEVSERVER_PORT:-9000}" ports: - - "127.0.0.1:${NODE_PORT:-9001}:9000" # Parameterized port + - "${NODE_PORT:-9001}:9000" # Parameterized port, accessible on all interfaces command: ["/app/docker/docker-frontend.sh"] env_file: - path: docker/.env # default diff --git a/superset-frontend/webpack.config.js b/superset-frontend/webpack.config.js index 94c0adf775c..fb806e0cb61 100644 --- a/superset-frontend/webpack.config.js +++ b/superset-frontend/webpack.config.js @@ -51,11 +51,17 @@ const MINI_CSS_EXTRACT_PUBLICPATH = './'; const { mode = 'development', - devserverPort = 9000, + devserverPort: cliPort, + devserverHost: cliHost, measure = false, nameChunks = false, } = parsedArgs; +// Precedence: CLI args > env vars > defaults +const devserverPort = cliPort || process.env.WEBPACK_DEVSERVER_PORT || 9000; +const devserverHost = + cliHost || process.env.WEBPACK_DEVSERVER_HOST || '127.0.0.1'; + const isDevMode = mode !== 'production'; const isDevServer = process.argv[1].includes('webpack-dev-server'); @@ -568,7 +574,9 @@ if (isDevMode) { }, historyApiFallback: true, hot: true, + host: devserverHost, port: devserverPort, + allowedHosts: ['localhost', '.localhost', '127.0.0.1', '::1', '.local'], proxy: [() => proxyConfig], client: { overlay: {