[英]Angular AOT compilation failed
I need to put a website in production soon and am looking into the AOT to improve performance (my app needs about 3-4 secs to load on Chrome, 8-10 secs on Firefox, which is just not possible for production). 我需要尽快将一个网站投入生产,并且正在研究AOT以提高性能(我的应用需要大约3-4秒才能加载到Chrome上,需要8-10秒才能加载到Firefox上,但这根本无法投入生产)。
I followed the guide on https://angular.io/docs/ts/latest/cookbook/aot-compiler.html but am stuck with the compiling part... 我按照https://angular.io/docs/ts/latest/cookbook/aot-compiler.html上的指南进行操作,但仍停留在编译部分...
If I type : node_modules/.bin/ngc -p tsconfig-aot.json I will get a nice "Compilation failed" with a list of around 100 hundred errors, like this one : 如果我输入:node_modules / .bin / ngc -p tsconfig-aot.json,我将得到一个不错的“编译失败”,其中列出了大约100个错误,如下所示:
Error at /myapp/aot/app/contact/admin/contact-list.component.ngfactory.ts:64:7: Supplied parameters do not match any signature of call target.
I am not able to solve all of them, as some are coming from Angular directly (I guess), for example : 我无法解决所有问题,因为有些是直接来自Angular的(我想),例如:
Error at /myapp/node_modules/@angular/core/src/di/reflective_provider.d.ts:88:165: Cannot find name 'Map'.
Is the compilation failed related to all these errors and if I solve them the compilation will pass ? 编译失败是否与所有这些错误有关,如果我解决它们,编译会通过吗? If yes, is it normal that even Angular causes errors such as the one I provided ?
如果是,即使Angular也会导致错误,例如我提供的错误,是否正常?
Thanks ! 谢谢 !
Note : I am using Angular 2.1.1. 注意:我正在使用Angular 2.1.1。
For those who are interested : 对于那些感兴趣的人:
The compiler will fail if you have Typescript errors (even if you forgot to type a variable, for example public myVar;
will throw an error, public myVar: any;
will pass). 如果您遇到Typescript错误,编译器将失败(即使您忘记键入变量,例如
public myVar;
也会抛出错误, public myVar: any;
将通过)。
The angular errors shouldn't be appearing and it has been solved for me by adding this dependency in my package.json : 角度错误不应该出现,并且通过在package.json中添加此依赖项为我解决了:
"@types/core-js": "^0.9.34"
I was in the same boat as kinkaz. 我和金卡兹在同一条船上。 What worked for me was deleting the following from the tsconfig-aot.json file that the angular.io website suggested in the AoT tutorial...
对我有用的是从occonfig教程中angular.io网站建议的tsconfig-aot.json文件中删除以下内容...
just delete, 只是删除,
"typeRoots": [ "../../node_modules/@types/" ] “ typeRoots”:[“ ../../node_modules/@types/”]
from tsconfig-aot.json 来自tsconfig-aot.json
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.