{"id":19252,"library":"babel-polyfill","title":"Babel Polyfill","description":"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.","status":"deprecated","version":"6.26.0","language":"javascript","source_language":"en","source_url":"https://github.com/babel/babel/tree/master/packages/babel-polyfill","tags":["javascript"],"install":[{"cmd":"npm install babel-polyfill","lang":"bash","label":"npm"},{"cmd":"yarn add babel-polyfill","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-polyfill","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides ES5+ polyfills for built-in objects, promises, symbols, etc.","package":"core-js","optional":false},{"reason":"Provides runtime for async/await and generator functions.","package":"regenerator-runtime","optional":false}],"imports":[{"note":"Importing the module has no default export. Just import for side effects.","wrong":"import babelPolyfill from 'babel-polyfill'","symbol":"default","correct":"import 'babel-polyfill'"},{"note":"Assigning the result to a variable is unnecessary and misleading.","wrong":"const babelPolyfill = require('babel-polyfill')","symbol":"require","correct":"require('babel-polyfill')"},{"note":"Deprecated in favor of direct core-js/regenerator imports or @babel/preset-env. See warnings.","wrong":"import 'babel-polyfill'","symbol":"useBuiltIns","correct":"// Use @babel/preset-env with useBuiltIns instead"}],"quickstart":{"code":"// Install: npm install babel-polyfill\n// Import at entry point (before any other code)\nimport 'babel-polyfill';\n\n// Now you can use ES2015+ features\nconst map = new Map();\nconst set = new Set();\nconst promise = Promise.resolve('foo');\nconst symbol = Symbol('bar');\n\n// Array.from, Object.assign, etc. are available\nconst arr = Array.from('hello');\nconst merged = Object.assign({}, { a: 1 }, { b: 2 });\n\n// Async/await works if regenerator-runtime is included\nasync function test() {\n  return await Promise.resolve('done');\n}","lang":"javascript","description":"Shows how to import babel-polyfill to enable ES2015+ features like Map, Set, Promise, Symbol, Array.from, Object.assign, and async/await."},"warnings":[{"fix":"Replace import 'babel-polyfill' with import 'core-js/stable'; import 'regenerator-runtime/runtime'; or configure @babel/preset-env.","message":"babel-polyfill is deprecated. Use core-js/stable and regenerator-runtime/runtime directly, or use @babel/preset-env with useBuiltIns.","severity":"deprecated","affected_versions":">=6.26.0"},{"fix":"Do not use babel-polyfill with Babel >=7.4.0. Use direct polyfill imports.","message":"Babel 7.4.0 removed babel-polyfill. The package will return an empty module or error.","severity":"breaking","affected_versions":">=7.4.0"},{"fix":"Ensure babel-polyfill is imported only once in your entry point.","message":"Importing babel-polyfill multiple times may cause duplicate polyfills and increased bundle size.","severity":"gotcha","affected_versions":"*"},{"fix":"Use core-js v3 directly via `import 'core-js/stable'` for full ES2019+ support.","message":"babel-polyfill includes core-js v2, which does not support certain proposals like globalThis, flatMap, etc.","severity":"breaking","affected_versions":"6.x"},{"fix":"Switch to @babel/plugin-transform-runtime with corejs option for scoped polyfills.","message":"babel-polyfill pollutes the global scope. Use `@babel/plugin-transform-runtime` and `@babel/runtime` for non-global polyfills.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install core-js and regenerator-runtime, then use import 'core-js/stable'; import 'regenerator-runtime/runtime';","cause":"babel-polyfill was removed in Babel 7.4.0. The package no longer exists in newer versions.","error":"Module not found: Can't resolve 'babel-polyfill'"},{"fix":"Run npm install babel-polyfill (which installs these as dependencies) or install them separately.","cause":"babel-polyfill depends on core-js and regenerator-runtime. If they are not installed, import fails.","error":"Cannot find module 'regenerator-runtime' or 'core-js'"},{"fix":"Ensure import 'babel-polyfill' is at the top of your entry file, or import regenerator-runtime directly.","cause":"babel-polyfill includes regenerator-runtime, but if not imported or if using older version, regeneratorRuntime may be missing for async/await.","error":"Uncaught ReferenceError: regeneratorRuntime is not defined"},{"fix":"Use only one polyfill source. Prefer core-js/stable over babel-polyfill.","cause":"Both babel-polyfill and core-js/stable are imported, resulting in duplicate polyfills.","error":"Duplicate polyfills detected"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}