A tiny utility that allows importing babel-polyfill multiple times without causing duplicate initialization errors. Version 7.4.4 is the latest stable release; the package has seen no updates since 2018 and effectively acts as a polyfill wrapper for legacy Babel setups. It provides an idempotent import that checks if core-js or regenerator-runtime has already been loaded, preventing multiple polyfill application which can cause conflicts and performance issues. Unlike directly importing babel-polyfill, this package is safe to include in library code where consumers may also polyfill.
npm install idempotent-babel-polyfillNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows three ways to use the package: side-effect import, require, and calling the exported function.
Replace with direct imports: import 'core-js/stable'; import 'regenerator-runtime/runtime';
Use core-js directly or @babel/preset-env with useBuiltIns.
Ensure no other polyfill is loaded before this import.
Use dedupe tools or better: use core-js directly with proper configuration.
npm install babel-polyfill
Use idempotent-babel-polyfill to safely import only once.
Install babel-polyfill as a direct dependency.