Registry / devops / babel-minify

babel-minify

JSON →
library0.5.2jsnpmunverified

An ES6+ aware JavaScript minifier based on the Babel toolchain. Current stable version is 0.5.2, released in 2018. Development has been stalled since then; it is effectively in maintenance mode. Unlike traditional minifiers (UglifyJS, Terser), babel-minify operates on an AST that can understand modern ES6+ syntax, allowing it to minify code without needing to down-compile first. It works as a standalone CLI tool or as a Babel preset. Note: it is deprecated in favor of Terser for most use cases because Babel itself stopped maintaining it.

npm install babel-minify
INSTALL
IMPORT
SIG · BABEL-MINIFY
B
babel-minify
devopsjavascriptv0.5.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

minify
const minify = require('babel-minify');
import minify from 'babel-minify';
babel-minify does not ship ES module exports; use CommonJS require. The default export is a function.
minify
const minify = require('babel-minify').default || require('babel-minify');
const minify = require('babel-minify').minify;
There is no named export 'minify'; the default export is the function. In some bundlers, .default may be needed.
transform
const { transform } = require('@babel/core');
const { transform } = require('babel-minify');
babel-minify does not expose a transform function; use @babel/core for full Babel transformations.

Demonstrates basic usage of babel-minify Node API with mangling and dead code elimination options.

const minify = require('babel-minify'); const inputCode = `function hello(name) { console.log('Hello, ' + name); }`; const options = { mangle: { keepClassName: true }, deadcode: { keepFnArgs: false } }; try { const { code, map } = minify(inputCode, options); console.log('Minified code:', code); } catch (err) { console.error('Minification failed:', err); }
babel-minify --version
Debug
Known issues
deprecatedbabel-minify is no longer actively maintained; Babel recommends using Terser for minification.
fix
Switch to terser for active development and bug fixes.
affects: >=0.5.0
breakingBreaking change in 0.4.0: significant API overhaul; compatibility with older babel versions dropped.
fix
Update code to use new API; refer to changelog.
affects: >=0.4.0 <0.5.0
breakingRenamed from Babili to babel-minify in 0.2.0; package name changed.
fix
Replace 'babili' requires with 'babel-minify'.
affects: >=0.2.0
gotchaDoes not support ES module imports; must use require() or configure bundler accordingly.
fix
Use CommonJS require; if using ESM, consider dynamic import or use Terser.
affects: *
gotchaMissing dependencies in versions 0.5.0 and 0.5.1 causing installation failures.
fix
Upgrade to 0.5.2 or manually install missing peer dependencies like @babel/core.
affects: >=0.5.0 <=0.5.1
Errors
Common errors & fixes
Error: Cannot find module 'babel-plugin-minify-dead-code-elimination'
Missing dependency in babel-minify 0.5.0/0.5.1; the package didn't declare all dependencies.
fix
Upgrade to babel-minify@0.5.2 or install missing plugins manually.
TypeError: minify is not a function
Using ES module import (import minify from 'babel-minify') which returns an object with default property, not the function directly.
fix
Use `const minify = require('babel-minify');` or in ESM: `import minify from 'babel-minify';` with proper bundler handling.
Error: Preset babel-preset-minify not found.
babel-preset-minify is a peer dependency not automatically installed; missing or wrong version.
fix
Install babel-preset-minify explicitly: npm install babel-preset-minify --save-dev
ENOENT: no such file or directory, open 'input.js'
CLI command invoked without specifying input file correctly or file does not exist.
fix
Ensure input file path is correct and use --out-file for output.
Upgrade
Version history
0.5.2latest on npm
Audit
Dependencies
babel-preset-minifyrequiredbabel-minify is a wrapper around the minify preset; used internally.
Agent activity
9 hits · last 30 days
node
6
Resources
babel-minify — npm install babel-minify · libregistry