简体   繁体   中英

Angular 2.0 / NodeJS project size

I have been using angular 1.x for a while now and I am currently checking if it's possible for me to upgrade to 2.0. I am having two concerns .

  1. The web development I am doing is with a specific application server which does not have any NPM integration, no build options to transpile TypeScript and so on. This means I will be forced to use the JavaScript version.

  2. I am new to usage of NPM and I followed the basic tutorial of AngularJS 2.0. For this application which only has 50 lines of code the entire project is 50 MB on disk because all of the modules downloaded by NPM which I don't all need. This will be a huge dealbreaker because we have a development / quality / production server. If we have 10 web applications of (today) 500 KB, they will together become 500 MB. Transports to production will take ages.

Is this really how it works or am I missing something?

Most of the NPM modules run on your system, they wont be part of your web application build

There are many techniques like Ahead-Of-Time compilation, Tree shaking to ensure Only code that we need for our application to be part of final build.

Currently "Hello world" app for Angular2 is 49KB and Google is working to bring it down to 10KB.

Look at this blog post for more details

http://blog.mgechev.com/2016/06/26/tree-shaking-angular2-production-build-rollup-javascript/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM