Babili Webpack Plugin

raw JSON →
0.1.2 verified Sat Apr 25 auth: no javascript deprecated

A webpack plugin for Babili (now babel-minify), a babel-based minifier. The plugin operates on entire chunks/bundles, offering better toplevel scope optimizations compared to using babili as a babel-loader preset. Version 0.1.2 is the last under the babili name; it was renamed to babel-minify-webpack-plugin starting from v0.2.0. This package is deprecated; users should migrate to babel-minify-webpack-plugin or use TerserPlugin for webpack. Supports options like test, comments, sourceMap, parserOpts, and custom babel/babili instances.

error Module not found: Error: Can't resolve 'babili-webpack-plugin'
cause Package not installed or wrong package name.
fix
npm install babili-webpack-plugin --save-dev
error BabiliPlugin is not a constructor
cause Incorrect import style; the plugin is CommonJS and requires require().
fix
Use const BabiliPlugin = require('babili-webpack-plugin');
error TypeError: BabiliPlugin is not a function
cause Old API from v0.0.8 or earlier; options structure changed.
fix
Instantiate with new BabiliPlugin(babiliOptions, overrides) where babiliOptions is the first argument.
deprecated Package renamed to babel-minify-webpack-plugin. Install babel-minify-webpack-plugin instead.
fix npm uninstall babili-webpack-plugin && npm install --save-dev babel-minify-webpack-plugin
breaking API changed from new BabiliPlugin(options) to new BabiliPlugin(babiliOptions, overrides) in v0.0.9.
fix Pass babili preset options as first argument and overrides (test, comments, etc.) as second argument.
breaking Drop support for webpack < 4 in later versions? Check documentation for compatibility.
fix Upgrade to webpack >= 4 or stick to earlier version of this plugin.
gotcha If used with babel-loader and babili preset, the plugin might double-apply minification.
fix Avoid using babili as a preset in babel-loader if you use this plugin; let the plugin handle minification.
npm install babili-webpack-plugin
yarn add babili-webpack-plugin
pnpm add babili-webpack-plugin

Basic webpack configuration using BabiliPlugin to minify the output bundle, disabling comments and source maps.

const BabiliPlugin = require('babili-webpack-plugin');

module.exports = {
  entry: './src/index.js',
  output: { filename: 'bundle.js' },
  plugins: [
    new BabiliPlugin({}, {
      comments: false,
      sourceMap: false
    })
  ]
};