UglifyJS
UglifyJS copied to clipboard
Allow specific debugger statements to be preserved
Bug report or feature request? Feature request
I have source code with several debugger; statements scattered around. When I minify this code, I want to remove all but one of them, similar to how you can preserve comments with @preserve. The drop_debugger option allows you to change this, but only with an all or nothing effect. I don't have a preference on the notation, but I've used @preserve-debugger just to illustrate the issue.
Uglify version (uglifyjs -V)
uglify-es 3.3.10
JavaScript input
debugger;
debugger; // @preserve-debugger: I want this one to stay
debugger;
The uglifyjs CLI command executed or minify() options used.
uglifyjs input -c drop_debugger=false -o output1
uglifyjs input -c -o output2
JavaScript output or error produced.
output1:
output2:
debugger;debugger;debugger;