evenchange4 / svgr.macro

Run svgr at build-time with babel-plugin-macros.
MIT License
43 stars 4 forks source link

cache issues #44

Open VinSpee opened 5 years ago

VinSpee commented 5 years ago

Hi! I'm using svgr.macro in a large project with multiple developers adding icons in various branches. We've found that an icon will often throw an error like:

react-dom.development.js:55 Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

The icon is clearly there in the file system, referred to correctly, and used correctly.

Another developer can load up the project and not have any issue.

Is this an svgr.macro issue? or an svgr issue?

VinSpee commented 5 years ago

I identified this as a caching issue because when I update the glob, it works. for example,

  1. initial glob pattern: components/icons/*.svg
  2. add an icon to that path, get the error about it not existing
  3. update the glob pattern: components/icons/**/*.svg
  4. it works.