R
R
resibe2021-11-26 21:25:18
webpack
resibe, 2021-11-26 21:25:18

How to configure ImageMinimizerWebpackPlugin?

Hello I use this setup

const ImageMinimizerPlugin = require("image-minimizer-webpack-plugin");
const { extendDefaultPlugins } = require("svgo");
module.exports = defineConfig({
configureWebpack: (config) => {
config.plugins.push(
          new ImageMinimizerPlugin({
            minimizerOptions: {
              plugins: [
                [
                  "imagemin-svgo",
                  {
                    plugins: [
                      {
                        removeViewBox: false,
                      },
                    ],
                  },
                ],
                ["nonstandard-imagemin-package-name", { myOptions: true }],
              ],
            },
          })
        );
};
});

from documentation https://webpack.js.org/plugins/image-minimizer-web...
but I get
Module Warning (from ./node_modules/image-minimizer-webpack-plugin/dist/loader.js):
Unknown plugin: imagemin-svgo

Did you forget to install the plugin?
You can install it with:

$ npm install imagemin-svgo --save-dev
$ yarn add imagemin-svgo --dev

Installation does not help in any way...
On git I found an issue on such a problem https://github.com/webpack-contrib/image-minimizer... but
I do not quite understand what was meant 61a1261545da8544630160.png, how to solve the problem...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question