Solvedangular cli --prod does not work in Firefox ESR 45.9.0


running ´ng serve --prod´ and opening the application in Firefox ESR 45.9.0 throws an exception.

TypeError: this is undefined


ng: 1.6.5
npm: 5.6.0
Node: 8.9.4

Repro steps

  • ng new foobar
  • cd foobar
  • ng serve --prod
  • Open in Firefox ESR 45.9.0

Observed behavior

Blank page, error in console

Desired behavior

Everything works as expected


35 Answers

✔️Accepted Answer

Same problem here with Firefox 50.1.0. See #9362
Current workaround: instead of using
ng build --prod
ng build --aot --environment=prod --output-hashing=all --sourcemaps=false --extract-css=true --named-chunks=false --build-optimizer=true

The culprit is --target=production

Other Answers:

This is still not working, this needs more priority.

Might be related:

I confirmed in my testing that it is indeed PlatformRef (you can tell because this minified function has prototype property bootstrapModuleFactory

Here's the constructor that succeeds:

Here's the constructor that fails:

I'll continue investigating what is causing this, but my guess is function hoisting issues in old versions of FF that UglifyES did not account for.

A definitive solution has been identified ? We are planning to migrate from Angular 4 to Angular 6 and it's not possible for our client to lost one of the main browser...

Update :

Angular CLI: 6.2.3
Node: 8.10.0
OS: win32 x64
Angular: 6.1.8

Working again on Firefox 45.2.0 🍰

For Angular CLI 7 we are replacing uglify-es with terser: #11996.

It should help address this issue.

More Issues: