babel-preset-compat

raw JSON →
0.22.4 verified Sat Apr 25 auth: no javascript

A Babel preset that enables COMPAT mode for JavaScript transpilation, targeting older browsers and environments. Current stable version is 0.22.4. This package is part of the compat ecosystem, designed to simplify polyfilling and transpilation for maximum compatibility with legacy platforms. It differentiates itself by focusing specifically on 'compat' mode, reducing config overhead. However, it lacks documentation and has been in maintenance mode with no recent updates.

error Cannot find module 'babel-preset-compat'
cause Package not installed or not in node_modules.
fix
Run 'npm install --save-dev babel-preset-compat'.
error Preset threw error: unknown option '...'
cause Invalid or unsupported option passed to preset.
fix
Refer to source code for valid options; typical options include 'targets'.
gotcha No README provided; configuration options are undocumented.
fix Visit source code or use with caution; defaults may be unexpected.
deprecated Package has not been updated in over 2 years; may not support modern syntax.
fix Consider using @babel/preset-env with appropriate targets instead.
breaking Version 0.x has unstable API; breaking changes may occur between minor versions.
fix Pin exact version and test thoroughly.
npm install babel-preset-compat
yarn add babel-preset-compat
pnpm add babel-preset-compat

Demonstrates basic usage of the preset with custom targets for legacy browsers.

// Install: npm install --save-dev babel-preset-compat
// Then in babel.config.js:
module.exports = {
  presets: [
    ['babel-preset-compat', {
      targets: { ie: '11', chrome: '49' }
    }]
  ]
};