Custom Babel helpers for compatibility with older environments. Version 0.22.4, actively maintained. Provides thin wrappers around core Babel utilities for safer transpilation. Use alongside @babel/preset-env for targeted polyfilling. Differentiator: minimal overhead and explicit compat targets.
npm install babel-compatVerified import paths — ran on the pinned version, not inferred.
Basic Babel config using babel-compat plugin with IE11 target.
Use import syntax or upgrade to Node.js v14+ with --experimental-modules.
Replace target: 'ie11' with compatTargets: ['ie11'].
Ensure babel-compat plugin appears after @babel/preset-env in plugins array.
Add useBuiltIns: 'usage' and corejs: 3 in @babel/preset-env options.
Replace include: ['es6.object.assign'] with exclude: ['es6.object.assign'] (note inversion).
npm install babel-compat@0.22.4 --save-dev
Switch to ESM import syntax: import { babelCompatPlugin } from 'babel-compat'Replace target: 'ie11' with compatTargets: ['ie11']
Replace include with exclude (option inverted).