question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Large builds because of process.env

See original GitHub issue

As 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:closed
  • Created 7 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
thien-docommented, Oct 17, 2016

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.

0reactions
oriSomethingcommented, Feb 5, 2018

It seems this issue returned in react-scripts@1.1.0. The only different that the process.env object is wrapped with Object: Object({NODE_ENV:…}).NODE_ENV

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found