Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ZoneAwarePromise spec compliant and compatible with core-js #33989

Closed
TazmanianD opened this issue Nov 22, 2019 · 3 comments
Closed

Make ZoneAwarePromise spec compliant and compatible with core-js #33989

TazmanianD opened this issue Nov 22, 2019 · 3 comments
Assignees
Labels
Milestone

Comments

@TazmanianD
Copy link

@TazmanianD TazmanianD commented Nov 22, 2019

馃殌 feature request

Relevant Package

This feature request is for @angular/zone.js

Description

I'm not an Angular developer so I'm not in much of a position to provide details on the Angular side. I'm a developer working on a webpack application that uses core-js to provide polyfills and my application is one that other sites can embed in their application.

The core-js polyfill does some checks to determine if the system has a spec compliant Promise and if not, it will use its own setting it in the global scope. The ZoneAwarePromise does not pass the core-js checks and as a result gets overridden by core-js with the result being that the Angular application stops functioning.

Most of the initial responses to this problem is that you should load the core-js application first but in our case that is not an option since we're an external application that is loaded later as an asynchronous embedding.

There was an issue file for exactly this in the zone.js repo: angular/zone.js#783 so I'm basically recreating that issue here. That issue was just closed without any actual resolution and then the whole repo was archived when it was merged here.

There was a similar question posed in core-js: zloirock/core-js#319 that offers a suggestion for what seems like a simple change that can be made to ZoneAwarePromise that would make it compliant enough to pass the core-js checks.

The project that we were causing trouble for was using Angular 7.2.15.

Describe the solution you'd like

zloirock/core-js#319 (comment)

Describe alternatives you've considered

In our webpack application, the solution was to not import the polyfill as part of the webpack configuration but to only do it conditionally if there is no Promise at all:

if (!window.Promise) {
  require('core-js/modules/es.promise');
}
@ngbot ngbot bot added this to the needsTriage milestone Nov 23, 2019
@JiaLiPassion JiaLiPassion self-assigned this Nov 26, 2019
JiaLiPassion added a commit to JiaLiPassion/angular that referenced this issue Dec 1, 2019
@JiaLiPassion JiaLiPassion mentioned this issue Dec 1, 2019
3 of 14 tasks complete
@JiaLiPassion

This comment has been minimized.

Copy link
Contributor

@JiaLiPassion JiaLiPassion commented Dec 1, 2019

@TazmanianD , thanks, I have created a PR to implement Symbol.species of Promise.

mhevery added a commit that referenced this issue Dec 3, 2019
mhevery added a commit that referenced this issue Dec 3, 2019
@JiaLiPassion

This comment has been minimized.

Copy link
Contributor

@JiaLiPassion JiaLiPassion commented Dec 5, 2019

fixed by #34162, please wait for the next release, if the issue still exists, please tell me, thanks.

@angular-automatic-lock-bot

This comment has been minimized.

Copy link

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Jan 5, 2020

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants
You can鈥檛 perform that action at this time.