Registry / web-framework / babel-plugin-polyfill-corejs3

babel-plugin-polyfill-corejs3

JSON →
library0.14.2jsnpmunverified

A Babel plugin that automatically injects imports for core-js@3 polyfills based on the target environment. It works with @babel/preset-env's built-ins and useBuiltIns options to only include necessary polyfills. Version 0.14.2 supports @babel/core ^7.4.0 or ^8.0.0-0 (<8.0.0). Key differentiators: it is part of the official Babel polyfills family, replacing the older @babel/polyfill and babel-polyfill packages; it handles direct core-js imports without needing a separate transform; and it avoids injecting polyfills that are already supported by the target environment, reducing bundle size. It is actively maintained by the Babel team.

npm install babel-plugin-polyfill-corejs3
INSTALL
IMPORT
SIG · BABEL-PLUGIN-POLYF
B
babel-plugin-polyfill-corejs3
web-frameworkjavascriptv0.14.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default
import polyfillCorejs3 from 'babel-plugin-polyfill-corejs3'
const polyfillCorejs3 = require('babel-plugin-polyfill-corejs3')
CommonJS require works but ESM is preferred in Babel configs.
defineProvider
import { defineProvider } from 'babel-plugin-polyfill-corejs3'
Exported helper for custom polyfill provider setups.

Shows Babel configuration using babel-plugin-polyfill-corejs3 with @babel/preset-env to inject core-js@3 polyfills based on usage and targets.

// .babelrc example { "presets": [ ["@babel/preset-env", { "targets": "> 0.25%, not dead", "useBuiltIns": "usage", "corejs": 3 }] ], "plugins": [ ["polyfill-corejs3", { "method": "usage-global", "targets": "> 0.25%, not dead", "version": "3.39.0" }] ] }
Debug
Known issues
breakingShould not be used with @babel/polyfill or babel-polyfill
fix
Remove those packages; use core-js@3 directly via this plugin.
affects: *
gotchaRequires core-js@3 to be installed as a dependency
fix
npm install core-js@3
affects: *
deprecatedThe 'method' option with value 'usage-pure' is deprecated
fix
Use 'usage-global' or 'entry-global' instead.
affects: >=0.3.0
Errors
Common errors & fixes
Module not found: Can't resolve 'core-js/modules/...'
core-js@3 not installed
fix
npm install core-js@3
Error: Plugin babel-plugin-polyfill-corejs3 requires @babel/core version ^7.4.0 or ^8.0.0-0
Incompatible @babel/core version
fix
Upgrade @babel/core to ^7.4.0+ or use compatible version.
Upgrade
Version history
0.14.2latest on npm
Audit
Dependencies
@babel/corerequiredpeer dependency for Babel plugin compatibility
core-js-compatrequiredneeded to determine polyfill requirements based on targets
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
babel-plugin-polyfill-corejs3 — npm install babel-plugin-polyfill-corejs3 · libregistry