Migrates to Webpack 4

This commit is contained in:
Samuel Oloruntoba
2018-11-11 17:17:25 +01:00
committed by Zeno Rocha
parent 3382ea3d14
commit 5ef3f1a817
6 changed files with 112 additions and 859 deletions

View File

@ -1,6 +1,8 @@
const pkg = require('./package.json');
const path = require('path');
const webpack = require('webpack');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const production = process.env.NODE_ENV === 'production' || false;
@ -22,20 +24,27 @@ module.exports = {
{test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'}
]
},
optimization: {
minimizer: [
new UglifyJSPlugin({
parallel: require('os').cpus().length,
uglifyOptions: {
ie8: false,
keep_fnames: false,
output: {
beautify: false,
comments: false
}
}
})
]
},
plugins: production ? [
new webpack.optimize.UglifyJsPlugin({
beautify: false,
mangle: {
screw_ie8: true,
keep_fnames: true
},
compress: {
screw_ie8: true
},
comments: false
}),
new webpack.BannerPlugin({banner})
new webpack.BannerPlugin({ banner }),
new BundleAnalyzerPlugin({
analyzerMode: process.env.ANALYZE_BUILD ? 'server' : 'disabled'
})
] : [
new webpack.BannerPlugin({banner})
new webpack.BannerPlugin({ banner })
]
};