简体   繁体   English

使用 ng build --prod 构建时出错。 没有 --prod 标志和 ng serve 很好

[英]Error building with ng build --prod. Fine without --prod flag and ng serve

I have a project that built fine with ng build --prod until I upgraded the version of TypeScript from 2.72 to 2.92 in my package.json.我有一个使用 ng build --prod 构建良好的项目,直到我在 package.Z466DEEC76ECDF5FCA6D38571F6324 中将 TypeScript 的版本从 2.72 升级到 2.92。

After upgrading, I now get the following error:升级后,我现在收到以下错误:

ERROR in Cannot read property 'Symbol(Symbol.iterator)' of undefined无法读取未定义的属性“符号(Symbol.iterator)”中的错误

However, the project builds fine using ng build and runs fine using ng serve so I have no idea where this problem is occurring and the error doesn't tell me where the problem is in my project.但是,该项目使用 ng build 构建良好,使用 ng serve 运行良好,所以我不知道这个问题发生在哪里,并且错误并没有告诉我问题出在我的项目中。

I found the issue.我发现了这个问题。 Using resolveJsonModule seems to be the issue as pointed out via this issue on Github: https://github.com/angular/angular/issues/25456正如 Github 上的这个问题所指出的那样,使用 resolveJsonModule 似乎是问题: https://github.com/angular/angular/issues/25456

Exact same error.完全相同的错误。 Really surprised that this hasn't been fixed properly.真的很惊讶这还没有得到妥善解决。

Problem was I had no clue what the problem was as the error message was so vague.问题是我不知道问题是什么,因为错误消息是如此模糊。 Commenting out my json import in my app.module made the build work as intended.在我的 app.module 中注释掉我的 json 导入使构建按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM