jacobmischka / gatsby-plugin-react-svg

Adds svg-react-loader to gatsby webpack config
https://www.npmjs.com/package/gatsby-plugin-react-svg
MIT License
69 stars 21 forks source link

Default plugin setup not working in Gatsby version 3: "maskType" #45

Closed loekTheDreamer closed 3 years ago

loekTheDreamer commented 3 years ago

When loading the default setup in gatsby version 3 it produces the following error:

Warning: React does not recognize the maskType prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase masktype instead. If you accidentally passed it from a parent component, remove it from the DOM element.

// gatsby-config.js
    {
      resolve: "gatsby-plugin-react-svg",
      options: {
        rule: {
          // include: /svg/,
          include: /\.inline\.svg$/,
        },
      },
    },
// index.js
import Logo from "../svg/logo.inline.svg"

const IndexPage = () => <Logo />

export default IndexPage

image

loekTheDreamer commented 3 years ago

The problem was inside the actual svg and not the plugin. it was complaining about maskType="alpha", just remove it.

   <mask
        id="mask0"
        //  maskType="alpha"
        maskUnits="userSpaceOnUse"
        x="604"
        y="2"
        width="108"
        height="114"
      >
jacobmischka commented 3 years ago

You can use the filter options as described in the README to automatically strip that prop if you like. Glad you figured it out!

loekTheDreamer commented 3 years ago

You can use the filter options as described in the README to automatically strip that prop if you like. Glad you figured it out!

Oh is that what that is for 🤦‍♂️I wasn't sure. Thank you so much for the update.