Using npm:
npm install --save-dev babel-plugin-polyfill-es-shims
or using yarn:
yarn add babel-plugin-polyfill-es-shims --dev
Add this plugin to your Babel configuration:
{
"plugins": [["polyfill-es-shims", { "method": "usage-pure" }]]
}
This package supports the usage-pure
and usage-global
methods.
This plugin supports the following es-shims
polyfills.
For historical reasons, some of these packages are not under the @es-shims organization. They are explicitly marked in the following tables.
Builtin object or function | Package name | Owner |
---|---|---|
Array.prototype.every |
array.prototype.every |
|
Array.prototype.indexOf |
array.prototype.indexof |
|
Array.prototype.lastIndexOf |
array.prototype.lastindexof |
|
Array.prototype.map |
array.prototype.map |
|
Array.prototype.reduce |
array.prototype.reduce |
|
Array.prototype.reduceRight |
array.prototype.reduceright |
|
Array.prototype.some |
array.prototype.some |
|
Number.prototype.toExponential |
number.prototype.toexponential |
|
String.prototype.split |
string.prototype.split |
|
String.prototype.trim |
string.prototype.trim |
Builtin object or function | Package name | Owner |
---|---|---|
Array.prototype.includes |
array-includes |
Builtin object or function | Package name | Owner |
---|---|---|
Object.values |
object.values |
|
Object.entries |
object.entries |
|
Object.getOwnPropertyDescriptors |
object.getownpropertydescriptors |
|
String.prototype.padStart |
string.prototype.padstart |
|
String.prototype.padEnd |
string.prototype.padend |
Builtin object or function | Package name | Owner |
---|---|---|
Promise.prototype.finally |
promise.prototype.finally |
Builtin object or function | Package name | Owner |
---|---|---|
Array.prototype.flat |
array.prototype.flat |
|
Array.prototype.flatMap |
array.prototype.flatmap |
|
Object.fromEntries |
object.fromentries |
|
String.prototype.trimStart |
string.prototype.trimstart |
|
String.prototype.trimEnd |
string.prototype.trimend |
|
String.prototype.trimLeft |
string.prototype.trimleft |
|
String.prototype.trimRight |
string.prototype.trimright |
|
Symbol.prototype.description |
symbol.prototype.description |
Builtin object or function | Package name | Owner |
---|---|---|
globalThis |
globalthis |
|
Promise.allSettled |
promise.allsettled |
|
String.prototype.matchAll |
string.prototype.matchall |
Builtin object or function | Package name | Owner |
---|---|---|
AggregateError (for Promise.any ) |
es-aggregate-error |
|
Promise.any |
promise.any |
|
String.prototype.replaceAll |
string.prototype.replaceall |
Builtin object or function | Package name | Owner |
---|---|---|
Array.prototype.item |
array.prototype.item |
|
String.prototype.item |
string.prototype.item |
NOTE: This polyfill provider is only compatible with polyfills that follow the es-shims-api
specification. Additionally, those polyfills must live under the @es-shims
organization.
This provider fully supports ES2016+, but we are still working on ES5 and ES6 support. You can find the list of missing polyfills at missing-polyfills.md
.