If I try to test-build my application with ng build --prod --aot I get the following, quite short, error message:
$ ng build --prod
I had the same problem and found out it was caused by https://www.npmjs.com/package/url-parameter-append
There was an extra comma after a list of parameters in a function call
I removed the comma in my own copy of url-parameter-append.js and then it worked.
I reported the bug to the author of that package https://github.com/techinity/url-parameter-append/issues/10 , but really IMO the bug is