| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Coverage increased (+2.2%) to 89.862% when pulling 86c9684 on moos:fix-cra-env into 5c7c61d on visionmedia:master. |
Sorry, something went wrong.
|
I'm 👎 on this. It's adding very specific checks where this is really a shortcoming in electron. Is this even still an issue? I know this is kind of an old PR. |
Sorry, something went wrong.
|
Yup - definitely still an issue. It's not an electron issue -- the code referenced above ends up in CRA bundle that's consumed by the browser, thereby exposing the entirety of CRA app's various .env files to the web site visitor -- clearly, an unintended (and hard-to-detect, unless you analyze the bundle -- I bet most app devs don't do that!) side-effect of .env + debug. I'd be happy to submit an update if there is interest. |
Sorry, something went wrong.
|
Hi, sorry it took so long to get back. Could you rebase please? I'm okay with adding this check. |
Sorry, something went wrong.
merge from upstream
| // possible values: 'dots', 'progress' | ||
| // available reporters: https://npmjs.org/browse/keyword/karma-reporter | ||
| reporters: ['progress'], | ||
| reporters: ['mocha'], |
There was a problem hiding this comment.
So we can see that browser env was selected.
Sorry, something went wrong.
| "scripts": { | ||
| "lint": "xo", | ||
| "test": "npm run test:node && npm run test:browser", | ||
| "test": "npm --node run test:node && npm run test:browser && npm --electron run test:electron", |
There was a problem hiding this comment.
--node and --electron get passed to test as process.env.npm_config_node and process.env.npm_config_electron.
Sorry, something went wrong.
| } | ||
|
|
||
| // If debug isn't set in LS, and we're in Electron, try to load $DEBUG | ||
| if (!r && typeof process !== 'undefined' && 'env' in process) { |
There was a problem hiding this comment.
This is the critical part that was exposing process.env in the browser. It's been pulled out into the electron-specific flow.
Sorry, something went wrong.
| "test:browser": "karma start --single-run", | ||
| "test:node": "istanbul cover --dir coverage/node -x test.js node_modules/mocha/bin/_mocha", | ||
| "test:electron": "istanbul cover --dir coverage/electron -x test.js node_modules/mocha/bin/_mocha", | ||
| "posttest": "istanbul report --include coverage/**/coverage.json", |
There was a problem hiding this comment.
combines coverage for node + electron.
Sorry, something went wrong.
|
holy 🐟 -- let's hope I don't have to do that again! |
Sorry, something went wrong.
|
Ping! Would hate to see this become stale again. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Create React Apps have the nifty feature of getting environment variables either from the shell or .env files. These are then resolved and baked into the JS bundle by webpack.
When using debug, the entirety of your .env file gets exposed in the bundle, e.g.:
This PR fixes that situation by moving the env access to a separate file that isn't accessed when in browser mode.
Also should resolve #467 (comment).