You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version (complete output of terser -V or specific git commit)
4.6.6
Complete CLI command or minify() options used
terser -c --define process.env={} a.js
terser input
if (process.env.DEBUG) console.log('please remove');
terser output or error
({}).DEBUG&&console.log("please remove");
Expected result
void 0;
Discussion
The current behavior is correct from a conservative standpoint, because it's technically possible that Object.prototype.DEBUG has been defined. But given the exceedingly insignificant chance of this actually happening, it makes sense to provide the option to more aggressively inline the missing property as undefined, which would allow removing the log statement. Rollup actually does this by default already.
EDIT: clarified discussion slightly
The text was updated successfully, but these errors were encountered:
Bug report or Feature request?
Feature request
Version (complete output of
terser -V
or specific git commit)4.6.6
Complete CLI command or
minify()
options usedterser
inputterser
output or errorExpected result
Discussion
The current behavior is correct from a conservative standpoint, because it's technically possible that
Object.prototype.DEBUG
has been defined. But given the exceedingly insignificant chance of this actually happening, it makes sense to provide the option to more aggressively inline the missing property as undefined, which would allow removing the log statement. Rollup actually does this by default already.EDIT: clarified discussion slightly
The text was updated successfully, but these errors were encountered: