anchor.diff:    The `compilerOptions` section is unchanged except for one property. 
     **Set the `module` to `es2015`**. 
     This is important as explained later in the [Tree Shaking](#tree-shaking) section.
  +  
  +  `compilerOptions`部分只修改了一个属性：**把`module`设置为`es2015`。
  +  这一点非常重要，我们会在后面的[摇树优化](#tree-shaking)部分解释为什么。
   
     What's really new is the `ngc` section at the bottom called `angularCompilerOptions`. 
     Its `"genDir"` property tells the compiler 
     to store the compiled output files in a new `aot` folder.
  +  
  +  `ngc`区真正新增的内容是底部的`angularCompilerOptions`。
  +  它的`"genDir"`属性告诉编译器把编译结果保存在新的`aot`目录下。
   
     The `"skipMetadataEmit" : true` property prevents the compiler from generating metadata files with the compiled application. 
     Metadata files are not necessary when targeting TypeScript files, so there is no reason to include them.
  +  
  +  `"skipMetadataEmit" : true`属性阻止编译器为编译后的应用生成元数据文件。
  +  当输出成TypeScript文件时，元数据并不是必须的，因此不需要包含它们。
   
     ### Compiling the application
  +  
  +  ### 编译该应用
   
     Initiate AoT compilation from the command line using the previously installed `ngc` compiler by executing:
  +  
  +  在命令行中执行下列命令，借助刚安装好的`ngc`编译器来启动AoT编译：
  +  
   code-example(format='.').
     node_modules/.bin/ngc -p tsconfig-aot.json
   :marked
     `ngc` expects the `-p` switch to point to a `tsconfig.json` file or a folder containing a `tsconfig.json` file.
  +  
  +  `ngc`希望`-p`选项指向一个`tsconfig.json`文件，或者一个包含`tsconfig.json`文件的目录。
   
     After `ngc` completes, look for a collection of _NgFactory_ files in the `aot` folder (the folder specified as `genDir` in `tsconfig-aot.json`). 
  +  
  +  在`ngc`完成时，会在`aot`目录下看到一组*NgFactory*文件（该目录是在`tsconfig-aot.json`的`genDir`属性中指定的）。
   
     These factory files are essential to the compiled application. 
     Each component factory creates an instance of the component at runtime by combining the original class file
     and a JavaScript representation of the component's template.
     Note that the original component class is still referenced internally by the generated factory.
  +  
  +  这些工厂文件对于编译后的应用是必要的。
  +  每个组件工厂都可以在运行时创建一个组件的实例，其中带有一个原始的类文件和一个用JavaScript表示的组件模板。
  +  注意，原始的组件类依然是由所生成的这个工厂进行内部引用的。
  +  
   .l-sub-section
     :marked
       The curious can open the `aot/app.component.ngfactory.ts` to see the original Angular template syntax
       in its intermediate, compiled-to-TypeScript form.
  +    
  +    如果你好奇，可以打开`aot/app.component.ngfactory.ts`来看看原始Angular模板语法被编译成TypeScript时的中间结果。
   
       JiT compilation generates these same _NgFactories_ in memory where they are largely invisible.
       AoT compilation reveals them as separate, physical files.
  +    
  +    JiT编译器在内存中同样会生成这一堆*NgFactory*，但它们大部分是不可见的。
  +    AoT编译器则会生成在单独的物理文件中。
   
   :marked
   .alert.is-important
     :marked
       Do not edit the _NgFactories_! Re-compilation replaces these files and all edits will be lost. 
  +    
  +    不要编辑这些*NgFactory*！重现编译时会替换这些文件，你做的所有修改都会丢失。
   
   a#bootstrap
   .l-main-section
   :marked
     ## Bootstrap
  +  ## 引导
   
     The AoT path changes application bootstrapping.
  +  
  +  AoT也改变了应用的引导方式。
   
     Instead of bootstrapping `AppModule`, you bootstrap the application with the generated module factory, `AppModuleNgFactory`.
  +  
  +  引导的方式从引导`AppModule`改成了引导生成的模块工厂：`AppModuleNgFactory`。
   
     Switch from the `platformBrowserDynamic.bootstrap` used in JiT compilation to  
     `platformBrowser().bootstrapModuleFactory` and pass in the `AppModuleNgFactory`.    
  +  
  +  从使用JiT编译时的`platformBrowserDynamic.bootstrap`换成了`platformBrowser().bootstrapModuleFactory`，并把`AppModuleNgFactory`传进去。
   
     Here is AoT bootstrap in `main.ts` next to the familiar JiT version:
  +  
  +  这里是AoT版本`main.ts`中的引导过程，下一个是你所熟悉的JiT版本。
   
   +makeTabs(
     `cb-aot-compiler/ts/app/main.ts,
  
positive.code: :marked
    This cookbook describes how to radically improve performance by compiling _Ahead of Time_ (AoT) 
    during a build process.
  
  a#toc
  :marked
    ## Table of Contents
    * [Overview](#overview)
    * [_Ahead-of-Time_ vs _Just-in-Time_](#aot-jit)
    * [Compile with AoT](#compile)
    * [Bootstrap](#bootstrap)
    * [Tree Shaking](#tree-shaking)
    * [Load the bundle](#load)
    * [Serve the app](#serve)
    * [Source Code](#source-code)
  
  a#overview
  .l-main-section
  :marked
    ## Overview
    Angular component templates consist of a mix of standard html and Angular syntax (e.g. `ngIf`, `ngFor`). 
    
    Expressions like `ngIf` and `ngFor` are specific to Angular. The browser cannot execute them directly.
    
    Before the browser can render the application, Angular components and their templates must be converted to executable JavaScript. 
    We refer to this step as _Angular compilation_ or just plain _compilation_.
  
    You can compile the app in the browser, at runtime, as the application loads, using the _Just-in-Time_ (JiT) compiler. 
    This is the standard development approach shown throughout the documentation.
  
    JiT compilation incurs a runtime performance penalty. 
    Views take longer to render because of the in-browser compilation step. 
  
negative.code: 
  :marked
    Install a few new npm dependencies with the following command: 
  
    用下列命令安装少量新的npm依赖：
  
  code-example(format='.').
    npm install @angular/compiler-cli @angular/platform-server --save
  :marked
    You will run the `ngc` compiler provided in the `@angular/compiler-cli` npm package
    instead of the TypeScript compiler (`tsc`). 
    
    你要用`@angular/compiler-cli`包中提供的`ngc`编译器来代替TypeScript编译器（`tsc`）。
  
    `ngc` is a drop-in replacement for `tsc` and is configured much the same way.  
    
    `ngc`是一个`tsc`的高仿替代品，它们的配置方式几乎完全一样。
  
    `ngc` requires its own `tsconfig.json` with AoT-oriented settings.
    Copy the original `tsconfig.json` to a file called `tsconfig-aot.json`, then modify it to look as follows.
    
    `ngc`需要自己的带有AoT专用设置的`tsconfig.json`。
    把原始的`tsconfig.json`拷贝到一个名叫`tsconfig-aot.json`的文件中，然后像这样修改它：
  
  +makeExample('cb-aot-compiler/ts/tsconfig-aot.json', null, 'tsconfig-aot.json')(format='.')
  
  