UglifyJS-old
UglifyJS-old copied to clipboard
Remove calls to console.*
This change removes calls to console.* statements as requested in #124 (I couldn't get this code to attach to that issue...)
It does so by replacing statements that call console
methods with an empty block to be removed later by the squeeze function.
The caveat is that it only fully removes console function calls if they are executed as statements. If the calls are made elsewhere in the tree then they will just be replaced with 0. For example, the following boolean expression:
console.log("a") && console.log("b")
will be compressed to:
0&&0
Also, the function arguments will be removed so users should be aware that if an argument is a function call, it won't be executed. For example, the foo
function call will be totally removed in the following example:
console.log("this is bad", foo())
This can be executed from the commandline by adding the --no-console
flag