{"id":18983,"library":"babel-compat","title":"babel-compat","description":"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.","status":"active","version":"0.22.4","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install babel-compat","lang":"bash","label":"npm"},{"cmd":"yarn add babel-compat","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-compat","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core Babel dependency for transpilation","package":"@babel/core","optional":false},{"reason":"Recommended preset for environment targeting","package":"@babel/preset-env","optional":true}],"imports":[{"note":"ESM-only since v0.20, no CommonJS support","wrong":"const babelCompatPlugin = require('babel-compat').babelCompatPlugin","symbol":"babelCompatPlugin","correct":"import { babelCompatPlugin } from 'babel-compat'"},{"note":"Default export is ESM-only; requires bundler or Node.js --experimental-modules","wrong":"const babelCompat = require('babel-compat')","symbol":"default","correct":"import babelCompat from 'babel-compat'"},{"note":"Type is exported from main entry, do not import from 'types' subpath","wrong":"import { CompatTarget } from 'babel-compat/types'","symbol":"CompatTarget","correct":"import { CompatTarget } from 'babel-compat'"}],"quickstart":{"code":"import { babelCompatPlugin } from 'babel-compat';\n\nexport default {\n  plugins: [\n    [babelCompatPlugin, { target: 'ie11' }]\n  ]\n};","lang":"typescript","description":"Basic Babel config using babel-compat plugin with IE11 target."},"warnings":[{"fix":"Use import syntax or upgrade to Node.js v14+ with --experimental-modules.","message":"ESM-only since v0.20; CommonJS require() no longer works.","severity":"breaking","affected_versions":">=0.20"},{"fix":"Replace target: 'ie11' with compatTargets: ['ie11'].","message":"Option 'target' is deprecated in v0.22; use 'compatTargets' array instead.","severity":"deprecated","affected_versions":">=0.22"},{"fix":"Ensure babel-compat plugin appears after @babel/preset-env in plugins array.","message":"Plugin order matters: must be placed after @babel/preset-env to override helpers correctly.","severity":"gotcha","affected_versions":">=0.18"},{"fix":"Add useBuiltIns: 'usage' and corejs: 3 in @babel/preset-env options.","message":"Does not automatically polyfill; only rewrites helper calls. Use with core-js for full polyfills.","severity":"gotcha","affected_versions":">=0.1"},{"fix":"Replace include: ['es6.object.assign'] with exclude: ['es6.object.assign'] (note inversion).","message":"The 'include' option for selective helpers is deprecated since v0.22; use 'exclude' instead.","severity":"deprecated","affected_versions":">=0.22"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install babel-compat@0.22.4 --save-dev","cause":"Missing dependency or installed via npm with wrong registry.","error":"Cannot find module 'babel-compat'"},{"fix":"Switch to ESM import syntax: import { babelCompatPlugin } from 'babel-compat'","cause":"Using CommonJS require() which is not supported since v0.20.","error":"TypeError: babelCompatPlugin is not a function"},{"fix":"Replace target: 'ie11' with compatTargets: ['ie11']","cause":"Using deprecated 'target' option in v0.22+.","error":"Error: Plugin babel-compat: 'target' option is deprecated, use 'compatTargets'"},{"fix":"Replace include with exclude (option inverted).","cause":"Using deprecated 'include' option in v0.22+.","error":"Error: Unknown option 'include' for babel-compat"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}