Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Error: Plugin name should be specified' @svgr/webpack svgoConfig

I have @svgr/[email protected] installed and webpack config as below

use: [
    {
        loader: '@svgr/webpack',
        options: {
            svgoConfig: {
                plugins: [
                    {
                        removeViewBox: false,
                    },
                ],
            },
        },
    },
],

But I am getting an error as below:

Error: Plugin name should be specified
like image 221
Deepak Negi Avatar asked Mar 10 '26 12:03

Deepak Negi


1 Answers

The latest SVGO documentation suggests that you need to assign each plugin object a name. Your configuration is out of date so it's most likely a version/update issue. Try changing the options object in your config to:

svgoConfig: {
  plugins: [
    {
      name: 'preset-default',
      params: {
        overrides: {
          // disable plugins
          removeViewBox: false,
        },
      },
    },
  ],
},

The preset-default plugin allows you to customise the defaults and allows you to disable plugins that are enabled by default.

like image 68
Mayron Avatar answered Mar 13 '26 01:03

Mayron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!