Compress app.bundle.js (typesript)

Hi , i recently start using ionic2 and im testing it, im really new also with typescript and i don’t know how to use webpack …
after everyu build i see that ionic generate the file app.bundle.js but it contains comments, whitespaces of angular2 and it’s size is pointless… there is a way to compress it?

You need add uglifyjs to gulp task. Google it :wink:

This should be part of the default process, at least for the production release.

Tried to add .pipe(uglify()) in the ionic-gulp-browserify-typescript script by it just hangs. Seems to need some Javascript fixing before…

I not tested with Ionic yet, but with pure javascript I use Obfuscator a lot to leave a dirty code.

@dugwood Check out the following post for a example how to achieve it using gulpfile.js. And it’s on the roadmap - here’s the issue on Github. I guess that it’ll soon become part of the build process for production releases.

Sorry, didn’t look for the issue on Github, I thought it was the only topic about it, my bad.

I’ve tried a similar approach to yours (changed directly the main module for testing purposes). But I have the same issue as in Ionic 2 - app.bundle.js - Minification

Anyway, I’ll wait for it to be fixed, thanks for the heads up :slight_smile:

@allpref: I’ve tried YUI compressor, which works great on all my javascript files, but it hanged on app.bundle.js too. That how I found this thread.

UPDATE: The minification is now part of the standard build process for TypeScript and JavaScript.

There’s an example in the linked post on how to enable it:

Besides updating to the latest version of ionic-gulp-tasks don’t forget to also update your gulpfile.js accordingly using the one in ionic2-app-base as template (TypeScript or JavaScript).