I'm at a total loss as to how to debug this.
I've built an application with Angular 5 and it is running great during development with ng serve --aot --progress=false --proxy-config proxy.conf.json
Now I am ready to deploy to production. I'm running ng build --prod --sm=false --aot --output-path=dist/client
and the build is successful.
I copy the client side files to the server and when I run in a browser I receive the following error.
FireFox:
TypeError: t[r] is undefined main.1eda0feb0dddc7c4747b.bundle.js:1:791705
Chrome
main.d8cd32d2ec09f8365918.bundle.js:1 Uncaught TypeError: Cannot read property 'call' of undefined
at n (main.d8cd32d2ec09f8365918.bundle.js:1)
at Object.t.exports (main.d8cd32d2ec09f8365918.bundle.js:1)
at n (main.d8cd32d2ec09f8365918.bundle.js:1)
at Object.t.exports (main.d8cd32d2ec09f8365918.bundle.js:1)
at n (main.d8cd32d2ec09f8365918.bundle.js:1)
at Object.t.exports (main.d8cd32d2ec09f8365918.bundle.js:1)
at n (main.d8cd32d2ec09f8365918.bundle.js:1)
at Object.t.exports (main.d8cd32d2ec09f8365918.bundle.js:1)
at n (main.d8cd32d2ec09f8365918.bundle.js:1)
at Object.<anonymous> (main.d8cd32d2ec09f8365918.bundle.js:1)
and if I go to the specific portion of the main bundle:
...return t[r].call(i.exports,i,i.exports,n),i.l...
How in the world do I debug this and figure out what is causing the problem?
After opening a ticket with angular/cli and a user having a conversation on Gitter with the team it appears this is related to a cli dependency. Adding the flag of --build-optimizer=false
should fix most cases. They are hoping to get it resolved with @angular/cli 1.6.5
Full conversation can be read at https://github.com/angular/angular-cli/issues/9244#issuecomment-358828083