Choosing core-js Polyfills: Stable, Modular, or Proposed
A decision guide for core-js@3: when to use core-js/stable, modular feature imports, and why to avoid core-js/proposed in production.
18 Jul 2025, 18:07 UTC

Decision and Constraints
Your application must run on browsers that do not support modern JavaScript features, but you also need to control bundle size and avoid breaking third-party scripts. core-js@3 provides three main ways to add missing features: a single global stable bundle, modular stable imports, and proposed feature polyfills. The wrong choice can ship unused code, mutate built-in objects globally, or rely on APIs that change between releases.
Use core-js@3 only. core-js@2 is end-of-life and does not receive security fixes.
Supported core-js Entry Points
A polyfill is code that adds a modern API to older environments. Tree-shaking is a bundler optimization that removes unused code from the final build. Prototype pollution happens when a library adds properties to built-in objects such as Array or Promise, potentially affecting other scripts.
| Entry point | What it does | Scope | Bundle impact | Production recommendation |
|---|---|---|---|---|
core-js/stable | Polyfills all finished ECMAScript features up to the installed core-js version and mutates built-in prototypes globally. | Entire application | Large; includes many features you may not use. | Only as a single entry-point import for broad legacy browser support. |
core-js/features/promise and similar | Polyfills one finished feature. Some imports still patch globals, for example Array.prototype.includes, but you include only what you import. | Per feature | Smaller; bundlers can tree-shake unused feature imports. | Preferred for application code. |
core-js/proposed | Polyfills ECMAScript proposals that are not yet finished standards. | Global or modular depending on import. | Variable; may include unstable code. | Avoid in production unless you pin an exact version and accept breakage. |
Trade-offs
core-js/stable is convenient because one import covers most finished features. The cost is a larger payload and global changes to built-in prototypes. If another library or a later browser version implements a feature differently, the global polyfill can mask bugs or cause conflicts.
Modular imports keep the bundle closer to the features you actually use. The downside is maintenance: every new language feature requires a new import, and you must keep the entry-point file organized.
core-js/proposed gives access to experimental APIs, but proposals can change or be removed between minor releases. Using it in production without strict pinning is a runtime risk.
Concrete Implementation: Modular Feature Imports
Assume an application needs Promise and Array.prototype.includes for older browsers. Create a single polyfill entry point:
// src/polyfills.js
import 'core-js/features/promise';
import 'core-js/features/array/includes';
// Application entry
import './polyfills';
import './app';
Run this command from the project root to confirm core-js@3 is installed:
node -e "console.log(require('core-js/package.json').version)"
Expected output begins with 3.. If the command fails or prints a 2. version, upgrade to core-js@3 before proceeding.
Then check that your source does not import the proposed entry point:
grep -R "core-js/proposed" src --include="*.js"
No matches is the expected result for production application code.
If you must support very old browsers globally and prefer one import, use this instead at the application entry point only:
// src/main.js
import 'core-js/stable';
import './app';
Do not combine core-js/stable with modular feature imports in the same bundle; doing so duplicates polyfill code.
Validation: Confirm What Shipped
After building, inspect the bundle statistics generated by your bundler. Search the output for core-js/stable and count occurrences of core-js/features. A modular strategy should show feature-specific imports and no stable entry point unless you intentionally added one.
Open the application in a target environment that lacks the feature, such as an older browser without native Promise, and confirm the API is available without ReferenceError or TypeError. Do not rely on a modern browser alone to validate a polyfill.
Limitations and Practical Checks
- Modular imports require explicit updates when you adopt new language features.
core-js/stableincreases initial load time because it includes polyfills for features your application may never call.- Patch releases can contain security fixes. Compare the installed version against your lockfile and advisory databases before deploying.
- Global prototype changes from
core-js/stablecan affect scripts loaded after your application entry point.
Practical check: run grep -R "core-js/proposed" src --include="*.js" before each production build. If it returns matches, remove them or document the exception with a pinned version.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.