2019-04-22 12:13:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								# Opting into Angular Ivy
 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-06 15:32:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-05 16:04:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
										 
									
								 
							
							
								# 选用 Angular Ivy ['aɪ  vɪ  ](常春藤)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-25 09:47:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								Ivy is the code name for Angular's [next-generation compilation and rendering pipeline ](https://blog.angular.io/a-plan-for-version-8-0-and-ivy-b3318dfc19f7 ). Starting with Angular version 8, you can choose to opt in to start using Ivy now, and help in its continuing develpment and tuning.
							 
						 
					
						
							
								
									
										
										
										
											2019-02-06 15:32:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-05 16:04:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								Ivy 是 Angular [下一代编译和渲染管道 ](https://blog.angular.io/a-plan-for-version-8-0-and-ivy-b3318dfc19f7 )的代号。从 Angular 的版本 8 开始,你就可以开始选用 Ivy 了,以帮助它继续开发和调优。
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-06 15:32:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-22 12:13:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								## Using Ivy in a new project
 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-06 15:32:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-05 16:04:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								## 在新项目中使用 Ivy
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 17:26:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								To start a new project with Ivy enabled, use the `--enable-ivy`  flag with the [`ng new` ](cli/new ) command:
							 
						 
					
						
							
								
									
										
										
										
											2019-02-06 15:32:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-05 16:04:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								要启动基于 Ivy 的新项目,可以在 [`ng new` ](cli/new ) 命令中使用 `--enable-ivy`  标志:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-06 15:32:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								```sh
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 17:26:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								ng new shiny-ivy-app --enable-ivy
							 
						 
					
						
							
								
									
										
										
										
											2019-02-06 15:32:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-22 12:13:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								The new project is automatically configured for Ivy. Specifically, the enableIvy option is set to `true`  in the project's `tsconfig.app.json`  file.
							 
						 
					
						
							
								
									
										
										
										
											2019-02-06 15:32:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-05 16:04:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
										 
									
								 
							
							
								这个新项目已经自动为 Ivy 配置好了。具体来说就是在项目的 `tsconfig.app.json`  文件中,  enableIvy 选项已设置为 `true`  。
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-22 12:13:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								## Using Ivy in an existing project
 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-06 15:32:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-05 16:04:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								## 在现有项目中使用 Ivy
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-19 18:04:34 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								To update an existing project to use Ivy, set the `enableIvy`  option in the `angularCompilerOptions`  in your project's `tsconfig.app.json` .
							 
						 
					
						
							
								
									
										
										
										
											2019-06-05 16:04:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
										 
									
								 
							
							
								要让现有项目使用 Ivy,  请在项目的 `tsconfig.app.json`  中的 `angularCompilerOptions`  中设置 `enableIvy`  选项。
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-06 15:32:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								```json
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								{
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								  "compilerOptions": { ... },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								  "angularCompilerOptions": {
							 
						 
					
						
							
								
									
										
										
										
											2019-03-25 16:19:17 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								    "enableIvy": true
							 
						 
					
						
							
								
									
										
										
										
											2019-02-06 15:32:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-19 18:04:34 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								To stop using the Ivy compiler, set `enableIvy`  to `false`  in `tsconfig.app.json` , or remove it completely.
							 
						 
					
						
							
								
									
										
										
										
											2019-06-05 16:04:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								要停止使用 Ivy 编译器,请在 `enableIvy`  中把 `tsconfig.app.json`  设置为 `false`  ,或者把它完全删除。