Deepak Negi
Deepak Negi

Reputation: 331

'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

Upvotes: 12

Views: 5894

Answers (1)

Mayron
Mayron

Reputation: 2394

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.

Upvotes: 17

Related Questions