You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2024/02/07 21:59:49 UTC
(superset) branch master updated: fix(webpack-dev-server): parse env args (#19744)
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new e986a1746f fix(webpack-dev-server): parse env args (#19744)
e986a1746f is described below
commit e986a1746f45423064f28df507b2f7ed97189352
Author: Jeremy <jd...@hotmail.com>
AuthorDate: Wed Feb 7 15:59:41 2024 -0600
fix(webpack-dev-server): parse env args (#19744)
---
CONTRIBUTING.md | 4 ++--
superset-frontend/webpack.proxy-config.js | 12 ++++++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e95a766dc7..4afa69eb2e 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 ebac689945..29823144d4 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(
'//+$/',
'',