Minifying / Uglifying code pushed to APK files


#1

Hello,
Did anyone manage to minify / uglify the CSS / JS without breaking up dependencies for Ionic 2? Or is this already handled automatically when packaging a built APK / iOS deployement?


#2

Hi,

“ionic-framework”: “2.0.0-beta.1”

webpack.config.js

var path = require('path');
var UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin');

module.exports = {
  entry: [
...
  ],
  output: {
...
  },
  module: {
...
  },
  resolve: {
...
  },
  plugins: [
    new UglifyJsPlugin({
      // to debug prod builds uncomment //debug lines and comment //prod lines

      // beautify: true,//debug
      // mangle: false,//debug
      // dead_code: false,//debug
      // unused: false,//debug
      // deadCode: false,//debug
      compress : { screw_ie8 : true, keep_fnames: true, drop_debugger: false, dead_code: false, unused: false, }, // debug
      // comments: true,//debug

      beautify: false,//prod
      // disable mangling because of a bug in angular2 beta.1, beta.2 and beta.3
      // TODO(mastertinner): enable mangling as soon as angular2 beta.4 is out
      // mangle: { screw_ie8 : true },//prod
      mangle: false,
      // compress : { screw_ie8 : true},//prod
      comments: false//prod

    })
  ]
};

Uglifying still failing.

No provider for e! (e -> e)

Minifying works.

Source:
https://github.com/AngularClass/angular2-webpack-starter/blob/master/webpack.prod.config.js#L146