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

痴心易碎 提交于 2021-02-10 14:23:33

问题


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:

ERROR in Cannot read property 'Symbol(Symbol.iterator)' of undefined

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.


回答1:


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.

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.



来源:https://stackoverflow.com/questions/58931483/error-building-with-ng-build-prod-fine-without-prod-flag-and-ng-serve

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!