angularuglifyjsgulp-uglifyuglifyjs2

Angular 2 Uglify JS is not mangled


I tried to uglify my code so my variable- and function-names don't show up in production files.

As far as i see, Angular CLI (ng build -prod) is not doing the job. So i tried gulp-uglify. Still i see most of my functions with full names:

this.showHeader$=this.showHeaderSource.asObservable()

Dosn't work on uglify js demo, too: http://lisperator.net/uglifyjs/transform


Solution

  • Angular CLI is running Uglify but currently Uglify does not rename properties which may be a lot (most?) of Angular Code.

    Original answer by Angular CLI collaborator:

    We do run Uglify on your code, but unfortunately Uglify does not rename properties, only function and variable names. A lot of your methods will be properties and not renamed by Uglify. We're looking at solutions but for the time being this is probably not going to change.