A Webpack Plugin for Babili - A babel based minifier
npm install babili-webpack-plugin --save-dev
// webpack.config.jsconst BabiliPlugin = ;moduleexports =entry: //...,output: //...,plugins:babiliOptions overrides
babiliOptions are passed on to the babili preset. Check https://github.com/babel/babili/tree/master/packages/babel-preset-babili#options.
test: JS file extension regex. Default:
comments: Preserve Comments. Default:
/@preserve|@licen(s|c)e/. falsy value to remove all comments. Accepts function, object with property test (regex), and values.
sourceMap: Default: uses webpackConfig.devtool. Set this to override that.
parserOpts: Configure babel with special parser options.
babel: Pass in a custom babel-core instead.
babili: Pass in a custom babili preset instead -
You can also use babel-loader for webpack and include
babili as a preset and should be much faster than using this - as babili will operate on smaller file sizes. But then, why does this plugin exist at all? -
node_modulesfrom being run through the babel-loader, babili optimizations are not applied to the excluded files as it doesn't pass through the minifier.