Babel preset that bundles babel-minify optimisation plugins for production builds. Version 2.0.0 requires Node >=10.13.0 and ships TypeScript types. It includes plugins for constant folding, dead code elimination, guarded expressions, inline consecutive adds, undefined-to-void, and optionally simplify. Unlike full minifiers, it focuses solely on optimisations without mangling or compression, giving finer control over the output. Options allow preserving function/class names and enabling simplify or undefined-to-void transforms. It is best used alongside a separate minification step.
npm install babel-preset-optimizationsVerified import paths — ran on the pinned version, not inferred.
Shows how to enable the preset with default options in a Babel configuration file.
Add 'minify' or another minification preset/plugin after this one.
Only enable simplify in production builds with source maps, or avoid it.
Use [["optimizations", { options }]] instead of ["optimizations", { options }].Upgrade Node to >=10.13.0 or stick with v1.x.
Use 'babel-preset-optimizations' instead of 'optimizations' if short name fails.
Ensure Babel is version 7 and use the correct preset reference: 'babel-preset-optimizations' or short name 'optimizations'.
Run 'npm install --save-dev babel-preset-optimizations' and check node_modules.
Use [['optimizations', { keepFnName: true }]] instead of ['optimizations', { keepFnName: true }].