This is craco plugin.
Optimizer using image-webpack-loader
# npm
$ npm install craco-image-optimizer-plugin
# yarn
$ yarn add craco-image-optimizer-plugin
We are using the options of image-webpack-loader
See image-webpack-loader for options settings
// craco.config.js
// @see https://github.com/sharegate/craco/blob/master/packages/craco/README.md#configuration-overview
const imageOptimizer = require('craco-image-optimizer-plugin');
module.exports = {
plugins: [
{
plugin: imageOptimizer,
// image-webpack-plugin options
options: {
mozjpeg: {
progressive: true,
quality: 65,
},
// optipng.enabled: false will disable optipng
optipng: {
enabled: false,
},
pngquant: {
quality: [0.65, 0.9],
speed: 4,
},
gifsicle: {
interlaced: false,
},
// the webp option will enable WEBP
webp: {
quality: 75,
},
},
},
],
};
MIT