Why do I keep getting this error: "Element type is invalid" when I try using ReactComponent to import svg files

Viewed 30

import { ReactComponent as MyIcon } from "../../assets/icons/12x12/arrow-down-12.svg"

and when I return , I keep getting this error:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.

I've tried inserting the component into another one, but still getting the same error.

What am I doing wrong? Why is it not working?

EDIT: My webpack config contains the following:

module.exports = {
    module: {
      rules: [
        {
          test: /\.svg$/i,
          issuer: /\.[jt]sx?$/,
          use: ['@svgr/webpack'],
        },
      ],
    },
  }
0 Answers
Related