Registry / serialization / babel-polyfill

babel-polyfill

JSON →
library6.26.0jsnpmunverified

Provides core-js and regenerator-runtime polyfills necessary for a full ES2015+ environment in browsers and Node.js. Version 6.26.0 is the last stable release of this package. Note: babel-polyfill is deprecated in favor of direct use of core-js and regenerator-runtime, or using @babel/preset-env with useBuiltIns. The package was removed in Babel 7.4.0 and has no further releases. This entry applies to v6.26.0.

npm install babel-polyfill
INSTALL
IMPORT
SIG · BABEL-POLYFILL
B
babel-polyfill
serializationjavascriptv6.26.0
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 'babel-polyfill'
import babelPolyfill from 'babel-polyfill'
Importing the module has no default export. Just import for side effects.
require
require('babel-polyfill')
const babelPolyfill = require('babel-polyfill')
Assigning the result to a variable is unnecessary and misleading.
useBuiltIns
// Use @babel/preset-env with useBuiltIns instead
import 'babel-polyfill'
Deprecated in favor of direct core-js/regenerator imports or @babel/preset-env. See warnings.

Shows how to import babel-polyfill to enable ES2015+ features like Map, Set, Promise, Symbol, Array.from, Object.assign, and async/await.

// Install: npm install babel-polyfill // Import at entry point (before any other code) import 'babel-polyfill'; // Now you can use ES2015+ features const map = new Map(); const set = new Set(); const promise = Promise.resolve('foo'); const symbol = Symbol('bar'); // Array.from, Object.assign, etc. are available const arr = Array.from('hello'); const merged = Object.assign({}, { a: 1 }, { b: 2 }); // Async/await works if regenerator-runtime is included async function test() { return await Promise.resolve('done'); }
Debug
Known issues
deprecatedbabel-polyfill is deprecated. Use core-js/stable and regenerator-runtime/runtime directly, or use @babel/preset-env with useBuiltIns.
fix
Replace import 'babel-polyfill' with import 'core-js/stable'; import 'regenerator-runtime/runtime'; or configure @babel/preset-env.
affects: >=6.26.0
breakingBabel 7.4.0 removed babel-polyfill. The package will return an empty module or error.
fix
Do not use babel-polyfill with Babel >=7.4.0. Use direct polyfill imports.
affects: >=7.4.0
gotchaImporting babel-polyfill multiple times may cause duplicate polyfills and increased bundle size.
fix
Ensure babel-polyfill is imported only once in your entry point.
affects: *
breakingbabel-polyfill includes core-js v2, which does not support certain proposals like globalThis, flatMap, etc.
fix
Use core-js v3 directly via `import 'core-js/stable'` for full ES2019+ support.
affects: 6.x
gotchababel-polyfill pollutes the global scope. Use `@babel/plugin-transform-runtime` and `@babel/runtime` for non-global polyfills.
fix
Switch to @babel/plugin-transform-runtime with corejs option for scoped polyfills.
affects: *
Errors
Common errors & fixes
Module not found: Can't resolve 'babel-polyfill'
babel-polyfill was removed in Babel 7.4.0. The package no longer exists in newer versions.
fix
Install core-js and regenerator-runtime, then use import 'core-js/stable'; import 'regenerator-runtime/runtime';
Cannot find module 'regenerator-runtime' or 'core-js'
babel-polyfill depends on core-js and regenerator-runtime. If they are not installed, import fails.
fix
Run npm install babel-polyfill (which installs these as dependencies) or install them separately.
Uncaught ReferenceError: regeneratorRuntime is not defined
babel-polyfill includes regenerator-runtime, but if not imported or if using older version, regeneratorRuntime may be missing for async/await.
fix
Ensure import 'babel-polyfill' is at the top of your entry file, or import regenerator-runtime directly.
Duplicate polyfills detected
Both babel-polyfill and core-js/stable are imported, resulting in duplicate polyfills.
fix
Use only one polyfill source. Prefer core-js/stable over babel-polyfill.
Upgrade
Version history
6.26.0latest on npm
Audit
Dependencies
core-jsrequiredProvides ES5+ polyfills for built-in objects, promises, symbols, etc.
regenerator-runtimerequiredProvides runtime for async/await and generator functions.
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources