Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsJul 7, 2026·3 min de lectura

core-js — Standard JavaScript Polyfill Library

A modular standard library for JavaScript that provides polyfills for ECMAScript features, enabling modern code to run in older environments.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
core-js Overview
Comando de instalación directa
npx -y tokrepo@latest install 115f2756-7a00-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con dry-run.

Introduction

core-js is the most widely used JavaScript polyfill library, providing implementations of ECMAScript standard features for environments that do not natively support them. It powers the polyfill pipeline of Babel and is depended on by millions of npm packages.

What core-js Does

  • Polyfills ECMAScript 2015 through 2024+ features (Promise, Symbol, Array methods, etc.)
  • Provides web platform API polyfills (structuredClone, URL, URLSearchParams)
  • Supports granular imports so applications only bundle needed polyfills
  • Integrates with Babel via @babel/preset-env for automatic polyfill injection
  • Supplies both global and pure (no-global-pollution) entry points

Architecture Overview

core-js is organized as a monorepo with the main polyfill package, a pure version that avoids modifying global prototypes, a compatibility data package, and a Babel integration helper. Each polyfill module is self-contained with its own dependency chain, allowing bundlers to tree-shake unused code when importing from specific paths.

Self-Hosting & Configuration

  • Install core-js and configure Babel preset-env with useBuiltIns: "usage" or "entry"
  • Use core-js-pure for library authors who must avoid global prototype modification
  • Pin to a specific core-js major version to prevent unexpected behavior changes
  • Check core-js-compat for per-feature browser support data
  • Bundle size is controlled by importing only specific modules rather than the full library

Key Features

  • Covers virtually every standardized and near-standard ECMAScript feature
  • Modular design with hundreds of individually importable polyfill paths
  • Pure version available for libraries that cannot pollute globals
  • Tight integration with Babel for automatic, usage-based polyfilling
  • Regularly updated as new TC39 proposals reach maturity

Comparison with Similar Tools

  • Babel — Transpiles syntax but relies on core-js for runtime feature polyfills
  • Modernizr — Detects feature support but does not polyfill missing features
  • es-shims — Individual polyfill packages per proposal; less integrated than core-js
  • polyfill.io — CDN-based polyfill service that detects the browser and serves only needed code; relies on core-js internally

FAQ

Q: Do I still need core-js if I target only modern browsers? A: If your target browsers natively support all features you use, you can skip it. Babel preset-env with a browserslist config will include only the polyfills your targets actually need.

Q: What is the difference between core-js and core-js-pure? A: core-js patches global constructors and prototypes (Array.prototype.flat, Promise, etc.). core-js-pure exports standalone functions without modifying globals, which is safer for libraries.

Q: How does core-js affect bundle size? A: A full import adds roughly 50-80 KB minified. Using Babel's useBuiltIns: "usage" or importing specific paths can reduce this to a few KB.

Q: Is core-js actively maintained? A: Yes. The project continues to track TC39 proposals and ECMAScript editions, though the maintainer has noted the sustainability challenges of a project this widely depended upon.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados