improve (minifation): improve minification at compile time

This commit is contained in:
Mickael Kerjean
2019-05-09 16:35:24 +10:00
parent 3899e26a81
commit d85bb41620
2 changed files with 11 additions and 4 deletions

View File

@ -57,7 +57,13 @@ let config = {
new webpack.optimize.OccurrenceOrderPlugin(),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'client', 'index.html'),
inject: true
inject: true,
minify: {
collapseWhitespace: true,
removeComments: true,
minifyJS: true,
minifyCSS: true,
}
}),
new CopyWebpackPlugin([
{ from: 'manifest.json', to: "assets/" },
@ -73,7 +79,8 @@ let config = {
if (process.env.NODE_ENV === 'production') {
config.plugins.push(new UglifyJSPlugin({
sourceMap: false
sourceMap: false,
extractComments: true,
}));
config.plugins.push(new CompressionPlugin({
asset: "[path].gz[query]",