Skip to content

Commit

Permalink
Configure optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
mpontus committed Oct 9, 2019
1 parent 4ed6a6a commit c7bff6f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"file-loader": "^4.2.0",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.8.0",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"style-loader": "^1.0.0",
"terser-webpack-plugin": "^2.1.0",
"url-loader": "^2.1.0",
"webpack": "^4.40.2",
"webpack-cli": "^3.3.9",
Expand Down
25 changes: 24 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const webpack = require("webpack");
const TerserWebpackPlugin = require("terser-webpack-plugin");
const OptimizeCssAssetsPlugin = require("optimize-css-assets-webpack-plugin");

module.exports = function(_env, argv) {
const isProduction = argv.mode === "production";
Expand Down Expand Up @@ -74,6 +76,27 @@ module.exports = function(_env, argv) {
isProduction ? "production" : "development"
)
})
].filter(Boolean)
].filter(Boolean),
optimization: {
minimize: isProduction,
minimizer: [
new TerserWebpackPlugin({
terserOptions: {
compress: {
comparisons: false
},
mangle: {
safari10: true
},
output: {
comments: false,
ascii_only: true
},
warnings: false
}
}),
new OptimizeCssAssetsPlugin()
]
}
};
};

0 comments on commit c7bff6f

Please sign in to comment.