简体   繁体   中英

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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