svg / svgo

⚙️ Node.js tool for optimizing SVG files
https://svgo.dev/
MIT License
20.97k stars 1.39k forks source link

[svgo 2.8.0] removeMetaData plugin throws errors #1669

Open bencresty opened 2 years ago

bencresty commented 2 years ago

Describe the bug

After upgrading to svgo 2.8.0 (from 1.x) and converting the config file from yml to js so far all plugins seem to work fine, except for the removeMetaData plugin. Once that plugin is enabled like this inside the plugins array:

        {
             name: 'removeMetaData', 
             params: {},
         },

... it throws an error during build:

Cannot read property 'get' of undefined during rendering of ...

When this plugin is disabled by removing it all other plugins are working fine (and I have a lot of plugins enabled here).

The plugin was working fine (at least didn't throw any error) when used with svgo 1.x and yml config files.

To Reproduce Steps to reproduce the behavior:

  1. Enable removeMetaData plugin as described above
  2. Run svgo
  3. See error

Expected behavior Plugin still working after upgrading and converting config file.

Desktop (please complete the following information):

TrySound commented 1 year ago

Could you please provide an example of svg where this fails and maybe exact config?