在将依赖项升级到 Angular 9(并执行必要的代码更改)后构建应用程序会引发错误:
编译@angular/animations:es2015 为esm2015 编译@angular/animations:es2015 为esm2015 编译@angular/core:es2015 为esm2015 编译@angular/core:es2015 为esm2015 编译@angular/core:es2015 为esm2015 错误:worker 错误#5:TypeError:无法读取 null 的属性“文件名”
然后它继续抛出以下错误:
编译 @angular/core : es2015 as esm2015 编译 @angular/compiler/testing : es2015 as esm2015 编译 @angular/core : es2015 as esm2015 错误: 试图用一个ngcc 备份文件,但它已经存在,因此不写入也不备份 node_modules/@angular/core/core.d.ts。
此错误可能是因为两个或多个入口点重叠,并且 ngcc 已被要求多次处理某些文件。您应该检查此包中的其他入口点并设置配置以忽略您未使用的任何入口点。
编译 @angular/core : es2015 as esm2015 发生未处理的异常:NGCC 失败。
原文由 kay-1234 发布,翻译遵循 CC BY-SA 4.0 许可协议
不幸的是,以前的答案都没有奏效。
降级 打字稿(在我的例子中是 4.8 到 4.6)解决了这个问题。