Stable ES features are not always polyfilled when needed
Created by: skoging
Describe the bug
Even with import 'react-app-polyfill/stable'
, some stable ES features are not polyfilled, such as String#matchAll
.
Even importing String#matchAll
directly from core-js does not work: import 'core-js/stable/string/match-all'
https://caniuse.com/#feat=mdn-javascript_builtins_string_matchall
Steps to reproduce
(Write your steps here:)
yarn create react-app polyfill-bug
cd polyfill-bug
yarn add react-app-polyfill
// index.js
import 'react-app-polyfill/ie11'
import 'react-app-polyfill/stable'
import 'core-js/stable/string/match-all'
const matches = 'some test string'.matchAll(/s(.)/g);
// IE11 or Safari:
// Error: Object doesn't support property or method 'matchAll'
console.log(Array.from(matches))
// [["te", "e"], ["t ", " "], ["tr", "r"]]
Expected behavior
Polyfill for stable ES features should be part of the bundle when importing react-app-polyfill/stable
.
In the case it isn't, explicitly importing the polyfill for the feature should work.