问题
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?
回答1:
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.
回答2:
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.
来源:https://stackoverflow.com/questions/46305424/unhandled-promise-rejection-windowglobal-promise-has-been-overwritten