-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Resolve #1085: Free __DEV__ variable provided by webpack should be used across RSK i… #1088
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…nstead of NODE_ENV checks
langpavel
requested changes
Feb 1, 2017
tools/webpack.config.js
Outdated
'process.env.BROWSER': true, | ||
__DEV__: isDebug, | ||
__DEV__: __DEV__, // eslint-disable-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- __DEV__: __DEV__, // eslint-disable-line
+ __DEV__,
@langpavel Thanks for the review, merged with latest webpack v2.2.1 changes and removed the |
@langpavel Forgot to remove the same line from the server config. Done now 👍 |
Rebased in #1114. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolve #1085
To my knowledge,
__DEV__
is a facebook code idiom that showed up relatively recently in the main React repo. Can see it all over the place here (may need to login to see github search results). Their build process has a step that replaces__DEV__
withprocess.env.NODE_ENV !== 'production'
.RSK currently has something similar,
__DEV__
is made available via webpack, we just have not been using it. This is likely due to a missing exception in the.eslintrc
allowing ano-underscore-dangle
exception for__DEV__
(and lack awareness of availability too!).Can see where
__DEV__
is made available in the current webpack.config.js here (same for client/server):Pull request would replace both process.env.NODE_ENV !== 'production' statements with
__DEV__
and add ano-comma-dangle
exception to the.eslintrc
.isDebug
inwebpack.config.js
should also be converted into__DEV__
as there is no reason to violate convention.++Readability
(p.s. Sorry for the pull request spam..
eslint --fix
which runs precommit alters code WHILE committing. So__DEV__ = true
if consumed like{option1: 'foo', __DEV__ : __DEV__}
is transformed and committed as{option1: 'foo', __DEV__}
which is less readable and certainly not a norm.. have never seen this pattern. Honestly did not even knowvar x = true; var y = {x};
was valid JS. Completely unexpected behaviour. Ended up disabling es-lint for those lines)