A Babel plugin that allows developers to freely customize polyfills, enabling the selection of any polyfill implementation (e.g., whatwg-fetch, unfetch, Zousan) instead of being limited to core-js or es-shims. Current stable version is 2.0.49, released on 2026-04-21, with weekly updates and frequent dependency bumps. Key differentiators: supports any polyfill, not just ECMAScript; uses browserslist to determine required polyfills; inserts polyfills via base64 data URIs for differential bundle serving. Alternative to @babel/preset-env's core-js-based polyfilling.
npm install babel-plugin-polyfill-customVerified import paths — ran on the pinned version, not inferred.
Configures babel-plugin-polyfill-custom with custom polyfill sources for Promise, fetch, and Object.assign, using usage-pure method.
Add @babel/preset-env to your Babel config alongside this plugin.
Configure your bundler to handle data URIs (see README for webpack/Rollup/Parcel examples).
Use ESM import syntax or const plugin = require('babel-plugin-polyfill-custom') (no .default).Rename the option to 'polyfills'.
Avoid combining with @babel/plugin-transform-runtime; use 'usage-entry' or 'entry' method instead.
npm install --save-dev babel-plugin-polyfill-custom
Use const babelPluginPolyfillCustom = require('babel-plugin-polyfill-custom'); (no .default)Ensure polyfill paths are absolute or correctly resolved from node_modules.