webpack.config.js
const path = require('path');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
entry: './src/index.js',
output: {
path: path.join(__dirname, 'dist'),
filename: 'index.js',
libraryTarget: 'umd',
libraryExport: 'default',
library: '_',
},
module: {
loaders: [{
test: /.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
}],
},
plugins: [
new UglifyJSPlugin(),
],
};