Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I disable UglifyJS chaining declarations with commas. I cannot use Breakpoints

UglifyJS uses commas to chain function, object and variable declarations. This is fine for productions and when the file is being minified however it makes it extremely hard to walk through the javascript with breakpoints when debugging js. I need to know how to turn this feature off in the UglifyJS Grunt Plugin.

Below is what the output looks like.

var boom = function(a) {
  ...
},
bing = function(b){
  ...
},
bam = function(c) {
  ...
};
like image 474
etoxin Avatar asked Aug 28 '14 04:08

etoxin


2 Answers

This might help Gulp users using gulp-uglify :

  .pipe( uglify({
    compress:{
      sequences:false
    }
  }) )
like image 94
Joe L. Avatar answered Sep 19 '22 14:09

Joe L.


Ok I figured it out. In the the Gruntfile under options > compress add an option

sequences: false

that will stop the semi-colons being replaced with commas. You can then use breakpoints like you would normally.

uglify: {
    options: {
        compress: {
            sequences: false
        }
    }
}
like image 31
etoxin Avatar answered Sep 22 '22 14:09

etoxin