Registry / devops / babel-preset-minify

babel-preset-minify

JSON →
library0.5.2jsnpmunverified

Babel preset that bundles all babel-minify plugins for minification. Current stable version is 0.5.2 (last release Sep 2018). This project is part of the babel/minify monorepo, which is now in maintenance mode with no active development. The preset provides a convenient way to apply minification transforms like dead code elimination, constant folding, mangle names, and more via a single preset. Unlike terser or uglify, it operates as a Babel transform, allowing integration with Babel workflows and AST-level optimizations. It supports options to enable/disable individual plugins and has known missing dependency issues.

npm install babel-preset-minify
INSTALL
IMPORT
SIG · BABEL-PRESET-MINIF
B
babel-preset-minify
devopsjavascriptv0.5.2
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ module.exports = require('babel-preset-minify')
✗ import preset from 'babel-preset-minify'
CommonJS only; ESM import will fail as package does not export ES modules. Use require() in Node.js.
preset declaration
✓ "presets": ["minify"] in .babelrc or babel.config.js
✗ "presets": ["babel-preset-minify"]
In Babel config, use the shorthand 'minify' without the 'babel-preset-' prefix.
Node API usage
✓ const babel = require('@babel/core'); babel.transform(code, { presets: ['minify'] })
✗ const minify = require('babel-preset-minify'); minify(code)
You must use the preset through Babel's transform API, not call it directly.

Demonstrates installation, .babelrc configuration with options, and Node API usage for minifying JavaScript.

// Install: npm install babel-preset-minify --save-dev // Example .babelrc { "presets": [ ["minify", { "mangle": { "exclude": ["MyCustomError"] }, "removeConsole": true, "keepFnName": false }] ] } // Node API usage const babel = require('@babel/core'); const fs = require('fs'); const code = fs.readFileSync('./input.js', 'utf8'); const output = babel.transformSync(code, { presets: ['minify'] }); fs.writeFileSync('./output.min.js', output.code);
Debug
Known issues
deprecatedbabel-minify project is no longer actively maintained. Consider using terser or a more modern minifier.
fix
Migrate to terser (via @babel/plugin-minify? but prefer standalone) or use babel-plugin-uglify or similar.
affects: >=0.5.0
breakingMissing dependencies in version 0.5.1 causing runtime errors
fix
Upgrade to 0.5.2 or pin to 0.5.0. Also, ensure all peer dependencies are installed (babel-core 6.x).
affects: 0.5.1
breakingRenamed from Babili to babel-minify in version 0.2.0. Old import paths and configuration break.
fix
Update presets from 'babili' to 'minify' and update package names accordingly.
affects: <0.2.0
deprecatedThe 'blacklist' option for mangle plugin renamed to 'exclude' in version 0.3.0.
fix
Use 'exclude' instead of 'blacklist' in mangle options.
affects: >=0.3.0
gotchaDoes not support ES modules. Only CommonJS via require(). Using import will fail.
fix
Use require() for Node.js. For bundlers, ensure Babel is configured properly.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'babel-preset-minify'
Forgot to install the package as devDependency.
fix
Run: npm install babel-preset-minify --save-dev
TypeError: Cannot read property 'minify' of undefined
Misconfigured Babel presets (e.g., using 'babel-preset-minify' instead of 'minify' or array syntax wrong).
fix
Use "presets": ["minify"] or "presets": [["minify", { options }]]
ERROR: The 'blacklist' option has been removed. Use 'exclude'.
Using old 'blacklist' option with babel-preset-minify >= 0.3.0.
fix
Replace 'blacklist' with 'exclude' in mangle options.
Module not found: Can't resolve 'babel-preset-minify' in ...
Webpack or other bundler trying to import the preset as a module directly.
fix
Do not import babel-preset-minify directly in code; use it only in Babel config.
Upgrade
Version history
0.5.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
babel-preset-minify — npm install babel-preset-minify · libregistry