使用ng build --prod构建时出错.不用--prod标志和ng服务就可以了
我有一个项目可以使用ng build --prod很好地构建,直到我将package.json中的TypeScript版本从2.72升级到2.92.
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.
升级后,我现在出现以下错误:
After upgrading, I now get the following error:
无法读取未定义的属性'Symbol(Symbol.iterator)'中的错误
ERROR in Cannot read property 'Symbol(Symbol.iterator)' of undefined
但是,该项目使用ng build可以很好地构建,而使用ng serve可以很好地运行,所以我不知道此问题发生在哪里,并且错误并不能告诉我问题出在我的项目中什么地方.
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.
我发现了问题.正如在Github上通过此问题所指出的那样,使用resolveJsonModule似乎是一个问题: https://github.comcom/angular/angular/issues/25456
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
完全相同的错误.真的很奇怪,这个问题没有得到正确解决.
Exact same error. Really surprised that this hasn't been fixed properly.
问题是我不知道问题出在哪里,因为错误消息如此含糊.注释掉我在app.module中的json导入使构建按预期进行.
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.