natemoo-re / astro-icon

Inline and sprite-based SVGs in Astro made easy!
https://astroicon.dev
Other
1.01k stars 57 forks source link

Build failing on astro@^1.6.8 with "Error: [astro-icon] Unable to load icon" #69

Closed Veylkh closed 1 year ago

Veylkh commented 1 year ago

Since updating to astro 1.6.8 (worked in .7), I'm getting this error:

generating static routes
--
07:56:29.563 | ▶ src/pages/index.astro
07:56:29.608 | file:///vercel/path1/.vercel/output/static/entry.mjs?time=1668840989319:2098
07:56:29.608 | throw new Error(`[astro-icon] Unable to load icon "${name}"!
07:56:29.608 | ^
07:56:29.608 |  
07:56:29.608 | Error: [astro-icon] Unable to load icon "tools/nvidia"!
07:56:29.609 | Error: Unknown builtin plugin "cleanupIDs" specified.
07:56:29.609 | at file:///vercel/path1/.vercel/output/static/entry.mjs?time=1668840989319:2098:13
07:56:29.609 | at async renderToIterable (file:///vercel/path1/.vercel/output/static/entry.mjs?time=1668840989319:903:21)
07:56:29.609 | at async renderAstroComponentInline (file:///vercel/path1/.vercel/output/static/entry.mjs?time=1668840989319:1476:24)
07:56:29.609 | at async renderChild (file:///vercel/path1/.vercel/output/static/entry.mjs?time=1668840989319:939:5)
07:56:29.609 | at async AstroComponent.[Symbol.asyncIterator] (file:///vercel/path1/.vercel/output/static/entry.mjs?time=1668840989319:861:7)
07:56:29.609 | at async renderAstroComponentInline (file:///vercel/path1/.vercel/output/static/entry.mjs?time=1668840989319:1477:9)
07:56:29.609 | at async renderChild (file:///vercel/path1/.vercel/output/static/entry.mjs?time=1668840989319:939:5)
07:56:29.609 | at async AstroComponent.[Symbol.asyncIterator] (file:///vercel/path1/.vercel/output/static/entry.mjs?time=1668840989319:861:7)
07:56:29.609 | at async renderAstroComponent (file:///vercel/path1/.vercel/output/static/entry.mjs?time=1668840989319:872:20)
07:56:29.610 | at async renderChild (file:///vercel/path1/.vercel/output/static/entry.mjs?time=1668840989319:935:5)
07:56:29.610 | at async renderChild (file:///vercel/path1/.vercel/output/static/entry.mjs?time=1668840989319:931:5)
07:56:29.610 | at async renderSlot (file:///vercel/path1/.vercel/output/static/entry.mjs?time=1668840989319:961:22)
07:56:29.642 | Error: Command "npm run build" exited with 1

I've tried all the new versions of astro (up to .10), along other updates or without, but to no avail. It seems to break with the other icons as well; they are stored in the repo itself and called as such:

---
import { Icon } from "astro-icon";
---
        <Icon
          class="h-12 filter grayscale-[80%] hover:grayscale-0 transition duration-500 ease-in"
          name="tools/nvidia"
          alt="NVIDIA"
        />

File path being src\icons\tools\nvidia.svg

If this has to do with astro itself, I can create an issue on their repo. Thanks!

Veylkh commented 1 year ago

Tried updating astro after astro-compress and it seems to be working now (suspecting that it might not be the cause, though).

Veylkh commented 1 year ago

It seems caused by doing npm up. Updating each dependency individually with npm i makes it work.

It's strange that it errors out by running npm up - possibly caused by the sub-dependencies newer versions?

Veylkh commented 1 year ago

Still getting the error. The message seems to have been updated:

 generating static routes 
▶ src/pages/index.astro
file:///[...]/.vercel/output/static/entry.mjs?time=1673432112179:2257
      throw new Error(`[astro-icon] Unable to load icon "${name}"!
            ^

Error: [astro-icon] Unable to load icon "ic:sharp-start"!
Error: Unknown builtin plugin "cleanupIDs" specified.
Danny-Rodriguez commented 1 year ago

Hey @Veylkh I'm having the same issue. I might look more into the cleanupID's when I have more time but for now I'm not using this addon until a fix is found.

stramel commented 1 year ago

Looks like you have updated to SVGO v3 which changed cleanupIDs to cleanupIds. There is a current issue already for this issue. #65