angular-cn/aio/dist/generated/docs/guide/angular-compiler-options.json

5 lines
22 KiB
JSON
Raw Permalink Normal View History

{
"id": "guide/angular-compiler-options",
"title": "Angular compiler options",
"contents": "\n\n\n<div class=\"github-links\">\n <a href=\"https://github.com/angular/angular/edit/master/aio/content/guide/angular-compiler-options.md?message=docs%3A%20describe%20your%20change...\" aria-label=\"Suggest Edits\" title=\"Suggest Edits\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">mode_edit</i></a>\n</div>\n\n\n<div class=\"content\">\n <h1 id=\"angular-compiler-options\">Angular compiler options<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"guide/angular-compiler-options#angular-compiler-options\"><i class=\"material-icons\">link</i></a></h1>\n<p>When you use <a href=\"guide/aot-compiler\">AOT compilation</a>, you can control how your application is compiled by specifying <em>template</em> compiler options in the <a href=\"guide/typescript-configuration\">TypeScript configuration file</a>.</p>\n<p>The template options object, <code>angularCompilerOptions</code>, is a sibling to the <code>compilerOptions</code> object that supplies standard options to the TypeScript compiler.</p>\n<code-example language=\"json\">\n {\n \"compilerOptions\": {\n \"experimentalDecorators\": true,\n ...\n },\n \"angularCompilerOptions\": {\n \"fullTemplateTypeCheck\": true,\n \"preserveWhitespaces\": true,\n ...\n }\n }\n</code-example>\n<a id=\"tsconfig-extends\"></a>\n<h2 id=\"configuration-inheritance-with-extends\">Configuration inheritance with extends<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"guide/angular-compiler-options#configuration-inheritance-with-extends\"><i class=\"material-icons\">link</i></a></h2>\n<p>Like the TypeScript compiler, The Angular AOT compiler also supports <code>extends</code> in the <code>angularCompilerOptions</code> section of the TypeScript configuration file.\nThe <code>extends</code> property is at the top level, parallel to <code>compilerOptions</code> and <code>angularCompilerOptions</code>.</p>\n<p>A TypeScript configuration can inherit settings from another file using the <code>extends</code> property.\nThe configuration options from the base file are loaded first, then overridden by those in the inheriting configuration file.</p>\n<p>For example:</p>\n<code-example language=\"json\">\n{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"experimentalDecorators\": true,\n ...\n },\n \"angularCompilerOptions\": {\n \"fullTemplateTypeCheck\": true,\n \"preserveWhitespaces\": true,\n ...\n }\n}\n</code-example>\n<p>For more information, see the <a href=\"https://www.typescriptlang.org/docs/handbook/tsconfig-json.html\">TypeScript Handbook</a>.</p>\n<h2 id=\"template-options\">Template options<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"guide/angular-compiler-options#template-options\"><i class=\"material-icons\">link</i></a></h2>\n<p>The following options are available for configuring the AOT template compiler.</p>\n<h3 id=\"allowemptycodegenfiles\"><code>allowEmptyCodegenFiles</code><a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"guide/angular-compiler-options#allowemptycodegenfiles\"><i class=\"material-icons\">link</i></a></h3>\n<p>When <code>true</code>, generate all possible files even if they are empty. Default is <code>false</code>. Used by the Bazel build rules to simplify how Bazel rules track file dependencies. Do not use this option outside of the Bazel rules.</p>\n<h3 id=\"annotationsas\"><code>annotationsAs</code><a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"guide/angular-compiler-options#annotationsas\"><i class=\"material-icons\">link</i></a></h3>\n<p>Modifies how Angular-specific annotations are emitted to improve tree-shaking. Non-Angular annotations are not affected. One of <code><a href=\"api/upgrade/static\" class=\"code-anchor\">static</a> fields</code> (the default) or <code>decorators</code>.</p>\n<ul>\n<li>\n<p>By default, the compiler replaces
}