Registry / serialization / babel-plugin-polyfill-es-shims

babel-plugin-polyfill-es-shims

JSON →
library0.10.11jsnpmunverified

A Babel plugin that automatically injects imports for es-shims polyfills based on target environments. Version 0.10.11, stable release part of the babel-polyfills monorepo. Key differentiator: modular approach to polyfilling ECMAScript built-ins, compatible with `core-js` and custom shims. Integrates with `@babel/preset-env` and supports `useBuiltIns: 'usage'` style. Active development, follows Babel releases.

npm install babel-plugin-polyfill-es-shims
INSTALL
IMPORT
SIG · BABEL-PLUGIN-POLYF
B
babel-plugin-polyfill-es-shims
serializationjavascriptv0.10.11
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import plugin from 'babel-plugin-polyfill-es-shims'
const plugin = require('babel-plugin-polyfill-es-shims').default
CommonJS require works, but avoid .default in ESM contexts
plugin as named export
import { default as plugin } from 'babel-plugin-polyfill-es-shims'
Only default export is available; named exports are not provided
insert parameters
['polyfill-es-shims', { targets: { ie: '11' }, method: 'usage-global' }]
['polyfill-es-shims', { targets: { ie: '11' }, method: 'usage' }]
method 'usage' is deprecated; use 'usage-global' or 'usage-pure' since v0.10

Configures Babel to inject imports for ES shims based on target browsers, using the usage-global method.

// babel.config.js module.exports = { presets: [ ['@babel/preset-env', { targets: '> 0.25%, not dead', useBuiltIns: false // Let the polyfill plugin handle it }] ], plugins: [ ['babel-plugin-polyfill-es-shims', { method: 'usage-global', // 'usage-pure' or 'usage-global' targets: { browsers: '> 0.25%, not dead' }, shouldInjectPolyfill: (name) => name.startsWith('es.'), // Optional filter exclude: ['es.array.iterator'] // Optional exclude specific polyfills }] ] };
Debug
Known issues
breakingDeprecated method 'usage' replaced by 'usage-global' and 'usage-pure'
fix
Use method: 'usage-global' or method: 'usage-pure'
affects: >=0.10.0
breakingRequires @babel/core ^7.4.0 || ^8.0.0-0 <8.0.0
fix
Update @babel/core to latest 7.x or pre-release 8.x
affects: >=0.10.0
gotchaPolyfill injection may not work with custom targets if not using @babel/preset-env's built-in support
fix
Ensure @babel/preset-env is configured with `useBuiltIns: false` and plugin targets are aligned
affects: >=0.10.0
gotchaWhen using `method: 'usage-pure'`, imported polyfills are added as pure expressions and may affect tree-shaking
fix
Use `method: 'usage-global'` for global polyfills or ensure tree-shaking is configured correctly
affects: >=0.10.0
deprecatedThe `es-shims` package may not be actively maintained; users may prefer `core-js` via babel-plugin-polyfill-corejs3
fix
Consider migrating to babel-plugin-polyfill-corejs3 for better maintenance and compatibility
affects: *
Errors
Common errors & fixes
Cannot find module 'babel-plugin-polyfill-es-shims'
Package not installed or not in node_modules
fix
npm install babel-plugin-polyfill-es-shims --save-dev
Error: Invalid method. Expected one of: "usage-global", "usage-pure"
Using deprecated 'usage' method string
fix
Change method to 'usage-global' or 'usage-pure' in plugin options
Polyfill "es.string.trim" is not available. Available polyfills: ...
The es-shims package does not include every ES shim; some are provided by other packages
fix
Ensure the needed polyfill is included in your es-shims dependency or use core-js polyfills with babel-plugin-polyfill-corejs3
Upgrade
Version history
0.10.11latest on npm
Audit
Dependencies
@babel/helper-define-polyfill-providerrequiredCore helper for configuring polyfill providers
Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
babel-plugin-polyfill-es-shims — npm install babel-plugin-polyfill-es-shims · libregistry