Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Unable to load the "local" icon set! #183

Closed
adamlevoy opened this issue Jan 2, 2024 · 1 comment · Fixed by #184
Closed

Error: Unable to load the "local" icon set! #183

adamlevoy opened this issue Jan 2, 2024 · 1 comment · Fixed by #184
Labels
bug Something isn't working

Comments

@adamlevoy
Copy link

adamlevoy commented Jan 2, 2024

What version of astro-icon are you using?

v1.0.1

Astro Info

Astro                    v4.0.9
Node                     v18.16.1
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/tailwind
                         astro-icon

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Getting error below for every instance of local icon when trying to run in local environment on Chrome and Safari. All my icons are local in src/icons. I was unable to reproduce issue via astro.new so I am providing repository. My project heavily uses this integration. Icon instances can be found in files that include:

  • src/sections/Hero_v2
  • src/components/IconCard
  • src/components/MiniReview
  • among others

11:12:48 [ERROR] [UnhandledRejection] Astro detected an unhandled rejection. Here's the stack trace: Error: Unable to load the "local" icon set! at eval (/Users/adam/Code/giddi-pages/node_modules/astro-icon/components/Icon.astro:39:19) at AstroComponentInstance.Icon [as factory] (/Users/adam/Code/giddi-pages/node_modules/astro/dist/runtime/server/astro-component.js:21:12) at AstroComponentInstance.init (/Users/adam/Code/giddi-pages/node_modules/astro/dist/runtime/server/render/astro/instance.js:39:29) at AstroComponentInstance.render (/Users/adam/Code/giddi-pages/node_modules/astro/dist/runtime/server/render/astro/instance.js:44:18) at Object.render (/Users/adam/Code/giddi-pages/node_modules/astro/dist/runtime/server/render/component.js:342:22) at Module.renderChild (/Users/adam/Code/giddi-pages/node_modules/astro/dist/runtime/server/render/any.js:36:17) Hint: Make sure your promises all have an awaitor a.catch() handler. Error reference: https://docs.astro.build/en/reference/errors/unhandled-rejection/ Stack trace: at /Users/adam/Code/giddi-pages/node_modules/astro-icon/components/Icon.astro:48:17 [...] See full stack trace in the browser, or rerun with --verbose.

Screenshot 2024-01-02 at 11 13 44 AM

What's the expected result?

Expect local icons directory to be found and for project to open at localhost.

Link to Minimal Reproducible Example

https://github.com/adamlevoy/giddi-pages

@natemoo-re
Copy link
Owner

I was able to track this down! It looks like an error is being thrown when loading your icons because the harness.svg contains <text> nodes. That definitely should be supported.

Two things for me to fix:

  1. Ensure that error messages are surfaced
  2. Figure out if the existing importDirectory util can log errors and continue, or, ideally just not error

@natemoo-re natemoo-re added the bug Something isn't working label Jan 2, 2024
natemoo-re added a commit that referenced this issue Jan 2, 2024
* fix(#183): warn and continue when local icon cannot be loaded

* chore: add changeset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants