-
Notifications
You must be signed in to change notification settings - Fork 408
core-js es6.promise conflicts with ZoneAwarePromise #783
Comments
More investigation: Turns out This piece of code:
Reference: https://github.com/zloirock/core-js/blob/master/modules/es6.promise.js#L22
I think zone.js should behave in a way that it can not be distinguished from native api. |
@jahtalab , all modules which provide |
@JiaLiPassion , Thanks for your response. Furthermore Also in this case we might be able to find a way to make |
@jahtalab , in my understanding, currently And I agree with you, that Can you provide more details about what conflicts that will occur when load |
While loading core-js before zone.js would get rid of the "Zone.js has detected that ZoneAwarePromise There are cases when we simply can't load core-js before zone. Lazy-loaded modules is such a case. As it is currently, I believe, a rather critical issue, I raised the point to the team of core-js project, specifically regarding why ZoneAwarePromise is not considered compliant and therefore is overriden. |
@michaelbazos , sure, I will check it! |
@michaelbazos this issue has been discovered long time ago in angular community. import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';
// etc |
@tytskyi , yeah, I agree with you. ZoneAwarePromise is already a full functional |
You seem to miss the point of the issue. I indeed don't need Let me give you a scenario:
And that's it. The application is broken because ZoneAwarePromise is not spec-compliant and will be replaced. So, what do we do? Loading zone after the vendor library, so as to fool the compliance check by core-js? That would work indeed. But what if my maps module is lazy-loaded? Then zone would be loaded before |
@michaelbazos , I see. thank you for the detail information.
I am not sure the detail about es6-promise implementation, but |
Just to add my 2 cents: I'm pretty new to the "new" Angular (I have an existing angular.js app that I am setting up to run in hybrid mode while I upgrade it), and zone.js has been giving me fits with this kind of thing; I ran into this problem with core-js, and am now encountering it again due to some widgets that I load on-demand overwriting In fact, the overall monkey-patching approach of zone.js has caused me problems. For example, there was a template that used interpolation to display an object as JSON, but with zone.js loaded angular.js instead called the object's This all seems very different from the angular.js philosophy. For example, angular.js does not modify the native Update: Just to mitigate my whining a bit, it looks like a dependency of a dependency (jsPDF -> html2canvas) of my project uses an ancient version of es6-promise (from over 3 years ago) that polyfills Promise if |
"we have to replace the promise to ZoneAwarePromise again" By adding couple lines for that missing requirement I can confirm that core-js, or es6-shim, are considering ZoneAwarePromise spec-compliant, and they don't replace them. Therefore the loading order doesn't matter. |
@michaelbazos, thank you for the detail information, I will try it. |
Any update on this? |
Getting the error "Uncaught (in promise): undefined zone.js " while using html2canvas in Angular 5 . |
@jain1403 , please provide a reproduce repo. |
Close for now for not be able to reproduce. |
Importing
core-js/shim
after zone.js would cause certain properties ofZoneAwarePromise
to be overwritten. Eventually it will end up in the wrong zone.Example:
It seems like importing
core-js/shim
first would resolve the issue. But I'm not sure about side effects of importingzone.js
aftercore-js/shim
.Could this issue be fixed regardless of importing order?
The text was updated successfully, but these errors were encountered: