Ionic 2 - app.bundle.js - Minification

It looks to me like buildBrowserify has built-in support for uglify…you can activate it by adding minify and uglifyOptions to the buildBrowserify options in gulpfile.js. Note than minification can be rather time-consuming (over 40 secs for me), so it’s probably a bad idea to minify with a watcher / auto-reloader. That would be very frustrating and unneeded for local dev.

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