Search code examples
angulartypescriptpolyfillszone.js

Unhandled Promise rejection: `(window|global).Promise` has been overwritten


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?


Solution

  • 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.