Juri Strumpflohner

RSS

Configure Ahead of Time (AoT) for your Angular app using the Angular CLI

Author profile pic
Juri Strumpflohner
Published
In our previous video we learned how to use the Angular CLI to create our first Angular application. Now it's time to prepare it for production. That requires some building, bundling, minifying and "Ahead of Time" compilation. In this video we will learn how simple it can be by using the Angular CLI.

TL;DW (Too long, didn’t watch): You can simply append the --aot to your build instruction, like ng build --prod --aot. Ya, it’s really that damn simple :smiley:

UPDATE (March 1st, 2017) - The Angular CLI now automatically builds with AoT enabled if you use the --prod flag. So there’s no need to add it explicitly. The --aot flag still remains though if you wanted to use AoT in dev mode for instance.

This video you will learn about…

  • how to use the Angular CLI to create a production bundle
  • what Ahead-of-time (AoT) compilation is about
  • how to use the Angular CLI to activate AoT compilation

You can download the source code I use in the video from my repository.

{% include article-link.html url=”https://angular.io/docs/ts/latest/cookbook/aot-compiler.html” title=“Angular Docs Cookbook: Ahead of Time Compilation” text=“Learn how to use Ahead-of-time compilation” imageurl=“/images/blog/old/linkpics/angular2logo.svg”

}}