Registry / devops / babel-minify-webpack-plugin

babel-minify-webpack-plugin

JSON →
library0.3.1jsnpmunverified

A webpack plugin that uses babel-minify (formerly babili) to minify JavaScript bundles. Current stable version is 0.3.1, released March 2018. Last release was a bugfix for webpack 4 tapable deprecation warnings. The plugin operates on entire chunks rather than individual files, enabling optimizations not possible with loader-based minification. However, it is slower than using babel-loader with the minify preset. The package has narrow engine requirements (Node 4.3–5.0 or >=5.10) and is essentially in maintenance mode, with no releases since 2018 and webpack 5 not officially supported. Alternatives include terser-webpack-plugin and babel-loader with preset-minify.

npm install babel-minify-webpack-plugin
INSTALL
IMPORT
SIG · BABEL-MINIFY-WEBPA
B
babel-minify-webpack-plugin
devopsjavascriptv0.3.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

MinifyPlugin
const MinifyPlugin = require('babel-minify-webpack-plugin');
import MinifyPlugin from 'babel-minify-webpack-plugin';
This package does not ship a default ESM export; use CommonJS require.
MinifyPlugin
// webpack.config.js const MinifyPlugin = require('babel-minify-webpack-plugin');
const Minify = require('babel-minify-webpack-plugin').default;
Direct require yields the constructor; .default is not defined.
MinifyPlugin
plugins: [new MinifyPlugin({ mangle: { topLevel: true } }, { sourceMap: true })]
plugins: [new MinifyPlugin({ comments: false })]
First argument is minify options (babel-preset-minify), second is plugin options (test, include, exclude, comments, sourceMap, etc.). Confusing the two arguments is common.

Webpack 4 configuration with babel-minify-webpack-plugin, including minify and plugin options.

// webpack.config.js const path = require('path'); const MinifyPlugin = require('babel-minify-webpack-plugin'); module.exports = { mode: 'production', entry: './src/index.js', output: { path: path.resolve(__dirname, 'dist'), filename: 'bundle.js' }, plugins: [ new MinifyPlugin( { mangle: { topLevel: true } }, { comments: false, sourceMap: false } ) ] };
Debug
Known issues
breakingAPI changed from `new BabiliPlugin(options)` to `new BabiliPlugin(babiliOptions, overrides)` in v0.0.9.
fix
Update constructor to `new BabiliPlugin(babiliOptions, overrides)` or use v0.3.1 (named babel-minify-webpack-plugin) with `new MinifyPlugin(minifyOpts, pluginOpts)`.
affects: <=0.0.8
deprecatedRenamed from babili-webpack-plugin to babel-minify-webpack-plugin in v0.2.0. Old package is deprecated.
fix
Install babel-minify-webpack-plugin instead of babili-webpack-plugin.
affects: <0.2.0
gotchaNode engine requirement: ">= 4.3 < 5.0.0 || >= 5.10". Node 5.0.0–5.9.x is not supported.
fix
Use Node >= 4.3 < 5.0 or >= 5.10 (e.g., Node 6+).
affects: all
gotchaWebpack 5 is not officially supported. The last release targets webpack 2, 3, and 4.
fix
Use terser-webpack-plugin for webpack 5, or test with this plugin but expect issues.
affects: all
gotchaThe plugin operates on the entire chunk, which can be slow for large bundles. Consider using babel-loader with preset-minify for faster builds.
fix
Use babel-loader with `presets: ['minify']` and enable `mangle.topLevel` if needed.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'babel-minify-webpack-plugin'
Package not installed or incorrectly named.
fix
Run `npm install babel-minify-webpack-plugin --save-dev` and use correct import.
TypeError: MinifyPlugin is not a constructor
Using ES6 import when the package does not have a default ESM export.
fix
Use `const MinifyPlugin = require('babel-minify-webpack-plugin');` instead of `import MinifyPlugin from '...'`.
Error: Plugin invalid: A non-default property of a plugin was used
Incorrect usage in webpack configuration (e.g., not instantiating the plugin).
fix
Ensure the plugin is instantiated with `new MinifyPlugin(...)` inside the `plugins` array.
Upgrade
Version history
0.3.1latest on npm
Audit
Dependencies
webpackrequiredpeer dependency: required to function as a webpack plugin
Agent activity
6 hits · last 30 days
node
6
Resources
babel-minify-webpack-plugin — npm install babel-minify-webpack-plugin · libregistry