Large builds because of process.env
See original GitHub issueAs mentioned in https://github.com/facebookincubator/create-react-app/pull/807#issuecomment-254051846
Description
Such approach can result in large development builds, if process.env.NODE_ENV
is used frequently in code… I’t because each time it becomes { whole: "config", NODE_ENV: "dev", ... }.NODE_ENV
.
Expected behavior
I think the better approach is to create definitions for both, so we get short aliases if possible and at the same time process.env is fully supported. That is create both mappings:
process.env.FOOBAR = 'xxx';
process.env = { FOOBAR: 'xxx' };
for each defined FOOBAR variable.
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
Jenkins build fails with "Treating warnings as errors because ...
maven - Jenkins build fails with "Treating warnings as errors because of process.env.CI = true" - Stack Overflow. Stack Overflow for Teams – ......
Read more >Building Better Bundles: Why process.env.NODE_ENV ...
NODE_ENV === “development”) will become dead code in a production build and be stripped out, thus reducing bundled code size and execution time....
Read more >Stop Treating warnings as errors because process.env.CI = true.
Hello, When running the react-scripts build on the CI, the build script does the following Treating warnings as errors because process.env.
Read more >Build fails because the environment block used to start a ...
Run "env" in CMD or Powershell. If it's not a large list, then it's most likely the variables generated as part of the...
Read more >New CI=true build configuration, "Treating warnings as errors ...
We introduced the environment variable only though. The warnings being treated as errors logic exists in the npm packages and not in our...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi guys, I can do this PR if @sheerun is busy. Is this what you are looking for: https://github.com/dvkndn/create-react-app/commit/3166668b638634d3c6411249b814045b58c7f2e5
If it is ok, should I create a PR? Also, I’m not sure if this is the best way to do that, but I’m willing to fix if you have any suggestion.
It seems this issue returned in
react-scripts@1.1.0
. The only different that theprocess.env
object is wrapped withObject
:Object({NODE_ENV:…}).NODE_ENV