diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e95a766dc716b..4afa69eb2e251 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -695,10 +695,10 @@ npm run dev-server npm run dev-server -- --port=9001 # Proxy backend requests to a Flask server running on a non-default port -npm run dev-server -- --supersetPort=8081 +npm run dev-server -- --env=--supersetPort=8081 # Proxy to a remote backend but serve local assets -npm run dev-server -- --superset=https://superset-dev.example.com +npm run dev-server -- --env=--superset=https://superset-dev.example.com ``` The `--superset=` option is useful in case you want to debug a production issue or have to setup Superset behind a firewall. It allows you to run Flask server in another environment while keep assets building locally for the best developer experience. diff --git a/superset-frontend/webpack.proxy-config.js b/superset-frontend/webpack.proxy-config.js index ebac6899455c9..29823144d4e9e 100644 --- a/superset-frontend/webpack.proxy-config.js +++ b/superset-frontend/webpack.proxy-config.js @@ -18,10 +18,18 @@ */ const zlib = require('zlib'); +const yargs = require('yargs'); // eslint-disable-next-line import/no-extraneous-dependencies -const parsedArgs = require('yargs').argv; +const parsedArgs = yargs.argv; -const { supersetPort = 8088, superset: supersetUrl = null } = parsedArgs; +const parsedEnvArg = () => { + if (parsedArgs.env) { + return yargs(parsedArgs.env).argv; + } + return {}; +}; + +const { supersetPort = 8088, superset: supersetUrl = null } = parsedEnvArg(); const backend = (supersetUrl || `http://localhost:${supersetPort}`).replace( '//+$/', '',