Ionic 2: Uglify with mangle: true

Hi,

I try to “uglified” the code of an Ionic2 app .
My gulp file is as following:

gulp.task('build', ['clean'], function(done){
  runSequence(
    ['sass', 'html', 'fonts', 'scripts'],
    function () {
      console.log('isRelease: ' + isRelease);
      buildBrowserify({
        minify: isRelease,
        browserifyOptions: {
          debug: !isRelease
        },
        uglifyOptions: {
          mangle: false
        }
      }).on('end', done);
    }
  );
});

But with the “mangle: false”, the code is not really “uglified”.

A mangler — reduce names of local variables to (usually) single-letters.

Is there a way to uglify with mangle: true?

1 Like

I hope I understand you correctly but why not simply do mangle:true?

Anyways, here is the doc for uglifyOptions, compress looks interesting https://github.com/terinjokes/gulp-uglify#options

I have not been clear, sorry.

mangle:true is not supported by Angular2.

I m looking for a “uglify” effective solution. To slow down reverse engineering.

are u referring to obfuscation?

I’m actually looking for a way to optimize app.bundle.js myself, I just haven’t managed to invest much time yet. How could angular 2 not supporting mangling, isn’t that just about shortening variable names?

I"m looking forward to Angular 2’s offline compiler, AFAIK, the stuff is closure compiler based, they they get that to work, it’ll be a huge boost of performance.