-
-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Large builds because of process.env #915
Comments
Would you like to send a PR for this? |
not right now |
Hi guys, I can do this PR if @sheerun is busy. Is this what you are looking for: thien-do@3166668 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. |
@dvkndn This looks reasonable, yes |
@gaearon thank you, I created a PR |
I tested this with To test it, I ran
Then I added this code to console.log(process.env.REACT_APP_1); and built the app with console.log("test1"); |
@fson It's probably only after minimization. Un-minimezed code is huge. |
The production code is always minified, so the size before minification should not matter in practice. But to be on the safe side I also checked this by disabling UglifyJS in the Webpack config and the non-minified output was: console.log(("test1")) @sheerun if you are still experiencing this issue, please create a reproducible demo (see details in the issue template). That will help us fix it faster, in case it still exists. |
It seems this issue returned in |
As mentioned in #807 (comment)
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:
for each defined FOOBAR variable.
The text was updated successfully, but these errors were encountered: