I have a simple app, initialized by angular-cli
.
It display some pages relative to 3 routes. I have 3 components. On one of this page I use lodash
Use latest angular cli version and use command ng build --prod --build-optimizer It will definitely reduce the build size for prod env.
This is what the build optimizer does under the hood:
The build optimizer has two main jobs. First, we are able to mark parts of your application as pure,this improves the tree shaking provided by the existing tools, removing additional parts of your application that aren’t needed.
The second thing the build optimizer does is to remove Angular decorators from your application’s runtime code. Decorators are used by the compiler, and aren’t needed at runtime and can be removed. Each of these jobs decrease the size of your JavaScript bundles, and increase the boot speed of your application for your users.
Note : One update for Angular 5 and up, the ng build --prod
automatically take care of above process :)