Skip to content

Commit

Permalink
Add ImageMinimizerPlugin to Webpack config
Browse files Browse the repository at this point in the history
  • Loading branch information
sumanthratna committed Jan 9, 2022
1 parent b468d4f commit 92f1189
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/react-scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin');
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
Expand Down Expand Up @@ -298,6 +299,14 @@ module.exports = function (webpackEnv) {
}),
// This is only used in production mode
new CssMinimizerPlugin(),
// This is only used in production mode
new ImageMinimizerPlugin({
minimizer: {
options: {
plugins: ['gifsicle', 'jpegtran', 'optipng', 'svgo'],
},
},
}),
],
},
resolve: {
Expand Down

0 comments on commit 92f1189

Please sign in to comment.