$ npm install babili-webpack-plugin
npm install babili-webpack-plugin --save-dev
// webpack.config.js
const BabiliPlugin = require("babili-webpack-plugin");
module.exports = {
entry: //...,
output: //...,
plugins: [
new BabiliPlugin(babiliOptions, overrides)
]
}
babiliOptions are passed on to the babili preset. Check https://github.com/babel/babili/tree/master/packages/babel-preset-babili#options. Default: {}.
test: JS file extension regex. Default: /\.js($|\?)/icomments: 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. require("babel-core")babili: Pass in a custom babili preset instead - require("babel-preset-babili").
``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_modules from being run through the babel-loader, babili optimizations are not applied to the excluded files as it doesn't pass through the minifier.|
|
|
|
|
|
© 2010 - cnpmjs.org x YWFE | Home | YWFE