natemoo-re / astro-icon

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

Icon not available issue #134

Closed cernezan closed 10 months ago

cernezan commented 11 months ago

I'm using Tabler icons on my website. I've notice that some icons are available and display correctly as expected. However when I try Mastodon icon for example (tabler:brand-mastodon), the Astro breaks and the icon isn't displayed. Am I missing something?

Error: Not Found: "brand-mastodon" in pack "tabler"
    at request (/Users/zancerne/Documents/cernezan.com/main/node_modules/astro-icon/lib/resolver.ts:17:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async get (/Users/zancerne/Documents/cernezan.com/main/node_modules/astro-icon/lib/resolver.ts:33:10)
    at async Module.load [as default] (/Users/zancerne/Documents/cernezan.com/main/node_modules/astro-icon/lib/utils.ts:153:22)
    at async eval (/Users/zancerne/Documents/cernezan.com/main/node_modules/astro-icon/lib/Icon.astro:22:17)
    at async AstroComponentInstance.render (/Users/zancerne/Documents/cernezan.com/main/node_modules/astro/dist/runtime/server/render/astro/instance.js:31:7)
    at async Module.renderChild (/Users/zancerne/Documents/cernezan.com/main/node_modules/astro/dist/runtime/server/render/any.js:33:5)
    at async EagerAsyncIterableIterator.next (/Users/zancerne/Documents/cernezan.com/main/node_modules/astro/dist/runtime/server/render/util.js:155:14)
    at async [Symbol.asyncIterator] (/Users/zancerne/Documents/cernezan.com/main/node_modules/astro/dist/runtime/server/render/astro/render-template.js:38:9)
    at async renderAstroTemplateResult (file:///Users/zancerne/Documents/cernezan.com/main/node_modules/astro/dist/runtime/server/render/astro/render-template.js:41:20)
dwightjack commented 10 months ago

I encountered the same issue with the logos collection. astro-icon uses a custom service to resolve iconify icons, so I guess that service might have outdated information.

As a workaround (at least it worked for me) you can overwrite the tabler collection with a local one (documentation):

  1. Create a src/icons/tabler.ts file
  2. file contents:

    import { createIconPack } from 'astro-icon/pack';
    
    export default createIconPack({
      // directly query iconify API 
      url: 'https://api.iconify.design/tabler/',
    });
cernezan commented 10 months ago

Thank you for the local setup instructions.

stramel commented 10 months ago

Hi! 👋🏼 Thank you for filling this. However it is a known issue with v0 and will be fixed in v1.

I'm going to close this as a duplicate of #29