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
adding babel plugin for IS_DEV
and IS_MINIFIED
transformation
#19690
adding babel plugin for IS_DEV
and IS_MINIFIED
transformation
#19690
Conversation
* @param {Object} babelTypes | ||
*/ | ||
module.exports = function(babelTypes) { | ||
const {types: t} = babelTypes; |
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.
Nit: inline this into the parameter
const {id, init} = path.node; | ||
if (t.isIdentifier(id, {name: 'IS_DEV'}) | ||
&& t.isBooleanLiteral(init, {value: true})) { | ||
path.replaceWith( |
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.
Just replace the init.
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.
I actually tried doing that...
can you please explain why line 73 is still true after this transform
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.
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.
done thanks
…emo-amp-custom-runner-part1
…emo-amp-custom-runner-part1
…emo-amp-custom-runner-part1
…emo-amp-custom-runner-part1
…emo-amp-custom-runner-part1
2148a72
to
1d159b8
Compare
…pproject#19690) * adding babel plugin for const transformation * adding test for transformer * fixing the is fortesting condition * fixing lints * fixing lints * fixing `is_minified` always true condition * lint fixes * fixing babel transformer * fixes copyrights
…pproject#19690) * adding babel plugin for const transformation * adding test for transformer * fixing the is fortesting condition * fixing lints * fixing lints * fixing `is_minified` always true condition * lint fixes * fixing babel transformer * fixes copyrights
Fixes #19618
IS_DEV
to false andIS_MINIFIED
to true if--isfortesting
is not present