Uglify processes the JavaScript for the sole purpose of optimization. Its job is to make the file super small in any way possible. To do this, it detects any non-variable conditions in the code, such as if (true) { return; }
. Since true
is always true, the functionality of this conditional is interpreted, and optimized for.
So, it's not an Uglify bug, since it did its job correctly. I'm not familiar with the trick Selectivizr is using, but if it works, it works.
Unfortunately, the only solution I can think of is not letting Uglify run on the file, and instead copy it over to dist/
directly.