11

I built the 5 MIN QUICKSTART app. Everything went okay. Then I minified it with webpack as it's suggested by angularJS docs. But finally I saw that the size of minified angularJS file is about 700 KB which is way too big and surprising while AngularJS 1.5.6 is 144 KB.

(None minified version of AngularJS 2 is about 5 MB while in AngularJS 1.x it's around 1 MB)

Am I missing something here or AngularJS 2 is really this big? My current version Of AngularJS is 2.0.0-rc.1.

1

2 Answers 2

1

You can now build a full package of Angular 2 minified of around 450 KB using ahead-of-time compiler. The following command apply minification and ahead-of-time compiler.

ng build --prod --aot

It uses angular-cli to package the whole application. The compressed (gzip) size is around 100 KB.

Sign up to request clarification or add additional context in comments.

Comments

0

Using the AoT seems to be the way to go however you have to keep in mind that the whole process isn't as simple as it may appear at first.

I'm currently trying to reduce de size of a bundle from an Angular-universal starter pack and the use of SASS into my components is breaking the AOT ( as well as some use of require() within my components ).

This post gives a good overview of how to maximize bundle size optimization for an Angular2 application : http://blog.mgechev.com/2016/06/26/tree-shaking-angular2-production-build-rollup-javascript/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.