If I try to test-build my application with ng build --prod --aot I get the following, quite short, error message:
ng build --prod --aot
$ ng build --prod
In my case it was a leftover comma at the end of a list of functions inside a custom .js file in \src directory.
\src
The tip of by --source-map=true and also setting --build-optimizer=false in angular.json helped me a lot.
--source-map=true
--build-optimizer=false
angular.json