{"id":20220,"library":"modify-babel-preset","title":"modify-babel-preset","description":"Utility to create a modified Babel preset by cloning an existing preset and applying plugin additions, removals, or configuration overrides. Current version 3.2.1. Helps avoid manual preset duplication by flattening nested presets into a single plugin list and applying transformations. Key differentiator: plugin filtering works on resolved filenames for precise matching. Works best with npm 3. Release cadence: sporadic, last release 2017.","status":"maintenance","version":"3.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/developit/modify-babel-preset","tags":["javascript","babel","preset"],"install":[{"cmd":"npm install modify-babel-preset","lang":"bash","label":"npm"},{"cmd":"yarn add modify-babel-preset","lang":"bash","label":"yarn"},{"cmd":"pnpm add modify-babel-preset","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM supported; require works in CJS contexts. Main export is a function.","wrong":"const modifyBabelPreset = require('modify-babel-preset')","symbol":"default","correct":"import modifyBabelPreset from 'modify-babel-preset'"},{"note":"CommonJS style with require. The package provides a single default function.","wrong":"","symbol":"default (CommonJS)","correct":"const modifyBabelPreset = require('modify-babel-preset')"},{"note":"No named export; must use default import. Common mistake to destructure.","wrong":"","symbol":"default (ESM named import)","correct":"import { modifyBabelPreset } from 'modify-babel-preset'"}],"quickstart":{"code":"const modifyBabelPreset = require('modify-babel-preset');\n\n// Remove 'transform-es2015-typeof-symbol' and add 'transform-react-jsx' from the es2015 preset\nmodule.exports = modifyBabelPreset('es2015', {\n  'transform-es2015-typeof-symbol': false,\n  'transform-react-jsx': true\n});","lang":"javascript","description":"Creates a modified preset by removing the typeof-symbol transform and adding the React JSX transform to the es2015 preset."},"warnings":[{"fix":"Ensure plugin names in the modifications object match the resolved filename (short name works, but avoid full relative paths).","message":"In v3.0.0, plugin paths are now resolved to filenames for matching; transformations must use plugin filenames (e.g., 'babel-plugin-transform-es2015-typeof-symbol' or its short name).","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Run 'npm install <preset-name>' before using modify-babel-preset.","message":"The preset must be installed as a dependency; modification does not install the preset automatically.","severity":"gotcha","affected_versions":"all"},{"fix":"Verify the final plugin order and configuration matches expectations, especially for presets that depend on ordering.","message":"Nested presets are flattened into a single plugins list; if a preset has nested presets, the resulting configuration may differ from the original preset's runtime behavior.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider using babel-preset-env or write your own preset programmatically.","message":"This package is in maintenance mode; Babel 7+ uses @babel/preset-env and presets are less commonly modified in this way.","severity":"deprecated","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install <preset-name> --save-dev","cause":"Missing installed preset as a dependency.","error":"Cannot find module 'babel-preset-<name>'"},{"fix":"Use the correct plugin name (e.g., 'transform-react-jsx' or 'babel-plugin-transform-react-jsx').","cause":"Plugin name not recognized; may need full babel-plugin- prefix or incorrect name.","error":"Plugin '<name>' is not a valid plugin"},{"fix":"modifyBabelPreset('es2015', {...})","cause":"The first argument to modifyBabelPreset must be a preset name string.","error":"Expected a string for preset name"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}