Create-react-app: Polyfilling Promise.allSettled does not work on Edge 18

Created on 6 Aug 2019  ยท  4Comments  ยท  Source: facebook/create-react-app

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 "[email protected]" is incompatible with requested version 
"prop-types@~15.6.0"
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ””โ”€ [email protected]
   โ””โ”€ [email protected]

react-app-polyfill version:

โžœ yarn list --pattern react-app-polyfill
yarn list v1.17.3
warning Resolution field "[email protected]" is incompatible with requested version "prop-types@~15.6.0"
โ””โ”€ [email protected]
โœจ  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.

bug needs triage

Most helpful comment

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

All 4 comments

try importing 'core-js/es/promise/all-settled' instead

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

Have you tried the fix suggested by @Roybie? I did not have the chance to try this yet.

@simonedavico I actually did that initially and it didn't work...ended up just polyfilling it myself

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Aranir picture Aranir  ยท  3Comments

DaveLindberg picture DaveLindberg  ยท  3Comments

alleroux picture alleroux  ยท  3Comments

Evan-GK picture Evan-GK  ยท  3Comments

fson picture fson  ยท  3Comments