Conditional compilation in uglify-js (node.js)

  node.js, question

uglify-js(2)There is a Conditional compilation in which the effect is as follows

Source code:

/** @const */ var DEBUG = false;
 (function () {
 "use strict";
 var longStr = "hello ";
 LongStr plus = "world ";
 if (DEBUG) {

After compilation:

var DEBUG=!  1;  !  function(){"use strict";  var r="hello ";  R plus ="world"} ();

When a global variable is setDEBUGAnd JSDOC is identified asCONST(ES6 followed byconst DEBUG = false), compression willif(DEBUG){}And the code in it.

Because onlyDEBUGFortrue, the code block can be executed; iffalseThere is no difference from directly annotating this block code. So I hope to beDEBUGFortrueWhen the user clicks the button, he will comment out the code block where he is located. How should he do this?

if (!  DEBUG) {