question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Polyfilling Promise.allSettled does not work on Edge 18

See original GitHub issue

Describe the bug

I am polyfilling Promise.allSettled via core-js and everything is working fine on Chrome and Firefox. However, when I open my webapp on Microsoft Edge, I get an error stating that allSettled is not defined:

Object doesn't support property or method 'allSettled'

Honestly I am not even sure if this should be filed here or under the core-js repository, in case it does not belong here I will move the issue there.

Did you try recovering your dependencies?

Yarn version:

➜ yarn --version
1.17.3

Which terms did you search for in User Guide?

I checked the guide for polyfills, and I am polyfilling like this in my app:

polyfills.js

import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';
import 'core-js/features/promise/all-settled';

index.js

import './polyfills';
import React from 'react';
import ReactDOM from 'react-dom';
//...

Environment

➜ npx create-react-app --info
npx: installed 91 in 11.825s

Environment Info:

  System:
    OS: macOS High Sierra 10.13.6
    CPU: (4) x64 Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz
  Binaries:
    Node: 11.7.0 - ~/.nvm/versions/node/v11.7.0/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.5.0 - ~/.nvm/versions/node/v11.7.0/bin/npm
  Browsers:
    Chrome: 75.0.3770.142
    Firefox: Not Found
    Safari: 12.1.2
  npmPackages:
    react: ^16.8.6 => 16.8.6
    react-dom: ^16.8.6 => 16.8.6
    react-scripts: 3.0.1 => 3.0.1
  npmGlobalPackages:
    create-react-app: Not Found

core-js version:

➜ yarn list --pattern core-js
yarn list v1.17.3
warning Resolution field "prop-types@15.7.2" is incompatible with requested version 
"prop-types@~15.6.0"
β”œβ”€ babel-runtime@6.26.0
β”‚  └─ core-js@2.6.3
β”œβ”€ core-js-compat@3.1.4
β”œβ”€ core-js-pure@3.1.4
β”œβ”€ core-js@3.1.4
β”œβ”€ fbjs@0.8.17
β”‚  └─ core-js@1.2.7
β”œβ”€ react-app-polyfill@1.0.1
β”‚  └─ core-js@3.0.1
β”œβ”€ recharts@1.4.3
β”‚  └─ core-js@2.5.7
└─ wait-on@3.2.0
   └─ core-js@2.6.9

react-app-polyfill version:

➜ yarn list --pattern react-app-polyfill
yarn list v1.17.3
warning Resolution field "prop-types@15.7.2" is incompatible with requested version "prop-types@~15.6.0"
└─ react-app-polyfill@1.0.1
✨  Done in 0.96s.

Steps to reproduce

  1. Install the latest core-js
  2. Polyfill Promise.allSettled from 'core-js/features/promise/all-settled';
  3. Try to call Promise.allSettled in Edge

Expected behavior

Promise.allSettled should be polyfilled (output below from Chrome):

Object.getOwnPropertyNames(Promise)
(8)Β ["length", "name", "prototype", "all", "race", "resolve", "reject", "allSettled"]

Actual behavior

Promise.allSettled is not polyfilled (output below from Edge):

Object.getOwnPropertyNames(Promise)
(8)Β ["prototype", "name", "reject", "resolve", "all", "race", "length"]

Reproducible demo

I could provide a repro repository if needed.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
gonzofishcommented, Feb 6, 2020

Same issue here, but with IE11 (so I’m sure it’s the same in Edge 18). Could this have something to do with the compat data? When I look in the debugger I don’t even see the file been bundled in

0reactions
iansucommented, May 19, 2021

If this is still an issue in the current version of Edge please open a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Promise.allSettled in babel ES6 implementation - Stack Overflow
function allSettled (promises) { let wrappedPromises = promises.map(p => Promise.resolve(p) .then( ... What you need to do is to make babel polyfill Promise....
Read more >
Promise.allSettled() - JavaScript - MDN Web Docs
If the iterable passed is non-empty but contains no pending promises, the returned promise is still asynchronously (instead of synchronously) fulfilled.
Read more >
JavaScript built-in: Promise: `allSettled()` - CanIUse
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop ... JavaScript built-in: Promise: allSettled().
Read more >
Promise.allSettled Polyfill - JSFiddle - Code Playground
The fiddle listings (Public, Private, Titled, etc) will now display latest versions instead of the ones saved as Base versions - this was...
Read more >
Polyfill for Promise.allSettled - Medium
all was it will fail even if one promise is rejected (not really a problem, more like depends on your use case) and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found