1

My polyfills.ts file contains:

import 'core-js/es6';
import 'core-js/es7/reflect';
require('zone.js/dist/zone');

Now I am frequently (but not always) getting thiserror:

Unhandled Promise rejection: Zone.js has detected that ZoneAwarePromise (window|global).Promise has been overwritten. Most likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded.

How can I fix this?

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
anand kumar
  • 69
  • 2
  • 5
  • Possible duplicate of [Unhandled promise rejection: Zone.js has detected that ZoneAwarePromise \`(window|global).Promise\` has been overwritten](https://stackoverflow.com/questions/42741628/unhandled-promise-rejection-zone-js-has-detected-that-zoneawarepromise-window) – ChrisGPT was on strike Sep 19 '17 at 20:11

2 Answers2

1

How can I fix this?

The code you presented is fine, i.e. the following is the correct order:

import 'core-js/es6';
import 'core-js/es7/reflect';
require('zone.js/dist/zone');

Now I am frequently (but not always)

You are probably importing some module sometimes that does it in the wrong order.

basarat
  • 261,912
  • 58
  • 460
  • 511
0

this issue have been fixed by https://github.com/angular/zone.js/pull/899, in the next version of zone.js(0.8.19), the error will gone.

jiali passion
  • 1,691
  • 1
  • 14
  • 19