我试图将我的angular2应用设置为AOT。似乎为此app.module.ngfactory.ts需要一个文件,而不是app.module.ts用于JIT编译的标准文件。我正在app.module.ts为我的标准JIT应用程序工作。我该如何将该文件的内容转换为预期的格式app.module.ngfactory.ts?
您需要使用进行编译ngc。基本步骤是:
1)安装AOT编译器
npm install @angular/compiler-cli
Run Code Online (Sandbox Code Playgroud)
2)将配置添加到tsconfig.json:
"angularCompilerOptions": {
"genDir": "aot",
"skipMetadataEmit" : true
}
Run Code Online (Sandbox Code Playgroud)
然后您可以运行ngc:
node_modules/.bin/ngc -p tsconfig.json
Run Code Online (Sandbox Code Playgroud)
在输出aot文件夹中,您将看到app.module.ngfactory.ts文件。
您可以在此处了解更多信息。
| 归档时间: |
|
| 查看次数: |
1038 次 |
| 最近记录: |