Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.

Commit daeb045

Browse files
hijiangtaoasnowwolf
authored andcommitted
fix: 更新选择编译器一节以同步官方最新文档
Issue angular/angular-cli#17736 (comment)
1 parent ecb9c70 commit daeb045

File tree

1 file changed

+6
-28
lines changed

1 file changed

+6
-28
lines changed

aio/content/guide/aot-compiler.md

+6-28
Original file line numberDiff line numberDiff line change
@@ -81,39 +81,17 @@ Angular offers two ways to compile your application:
8181

8282
Angular 提供了两种方式来编译你的应用:
8383

84-
* **_Just-in-Time_ (JIT)**, which compiles your app in the browser at runtime.
84+
* **_Just-in-Time_ (JIT)**, which compiles your app in the browser at runtime. This was the default until Angular 8.
8585

86-
***即时编译* (JIT)**,它会在运行期间在浏览器中编译你的应用。
86+
***即时编译* (JIT)**,它会在运行期间在浏览器中编译你的应用。Angular 8 及先前版本以此为默认选项。
8787

88-
* **_Ahead-of-Time_ (AOT)**, which compiles your app at build time.
88+
* **_Ahead-of-Time_ (AOT)**, which compiles your app and libraries at build time. This is the default since Angular 9.
8989

90-
**预先(AOT)编译**,它会在构建时编译你的应用
90+
***预先编译* (AOT)***,它会在构建时编译你的应用或库。从 Angular 9 开始这是默认选项
9191

92-
JIT compilation is the default when you run the [`ng build`](cli/build) (build only) or [`ng serve`](cli/serve) (build and serve locally) CLI commands:
92+
When you run the [`ng build`](cli/build) (build only) or [`ng serve`](cli/serve) (build and serve locally) CLI commands, the type of compilation (JIT or AOT) depends on the value of the `aot` property in your build configuration specified in `angular.json`. By default, `aot` is set to `true` for new CLI apps.
9393

94-
当你运行 [`ng build`](cli/build)(仅编译)或 [`ng serve`](cli/serve)(编译并启动本地服务器) 这两个 CLI 命令时 JIT 编译是默认选项:
95-
96-
<code-example language="sh" class="code-shell">
97-
ng build
98-
ng serve
99-
</code-example>
100-
101-
{@a compile}
102-
103-
For AOT compilation, include the `--aot` option with the `ng build` or `ng serve` command:
104-
105-
要进行 AOT 编译,只要让 `ng build``ng serve` 命令中包含 `--aot` 标志就行了:
106-
107-
<code-example language="sh" class="code-shell">
108-
ng build --aot
109-
ng serve --aot
110-
</code-example>
111-
112-
<div class="alert is-helpful">
113-
114-
The `ng build` command with the `--prod` meta-flag (`ng build --prod`) compiles with AOT by default.
115-
116-
带有 `--prod` 标志的 `ng build` 命令 (`ng build --prod`) 会默认使用 AOT 编译。
94+
当你运行 [`ng build`](cli/build)(仅编译)或 [`ng serve`](cli/serve)(编译并启动本地服务器) 这两个 CLI 命令时,编译方式(JIT 或者 AOT)取决于你在 `angular.json` 中编译选项中 `aot` 属性的取值。默认情况下,在 CLI 新起的项目中 `aot` 被设置为 `true`
11795

11896
See the [CLI command reference](cli) and [Building and serving Angular apps](guide/build) for more information.
11997

0 commit comments

Comments
 (0)