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

[v1] Unable to locate "folder/folder/svg" icon #178

Closed
nanarino opened this issue Jan 1, 2024 · 4 comments · Fixed by #179
Closed

[v1] Unable to locate "folder/folder/svg" icon #178

nanarino opened this issue Jan 1, 2024 · 4 comments · Fixed by #179

Comments

@nanarino
Copy link

nanarino commented Jan 1, 2024

What version of astro-icon are you using?

No response

Astro Info

Astro                    v3.6.4
Node                     v18.16.0
System                   Windows (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/mdx
                         astro-icon

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

No response

Describe the Bug

- "astro-icon": "^0.8.1",
+ "astro-icon": "^1.0.1",
import { Icon } from "astro-icon/components";
---
<Icon name="logo/color/clover" />
PS C:\Users\Administrator\Documents\GitHub\nanarinostyl> pnpm dev

> nanarinostyl@0.2.4 dev C:\Users\Administrator\Documents\GitHub\nanarinostyl
> astro dev --host

   astro  v3.6.4 started in 1303ms

  ┃ Local    http://localhost:4321/
  ┃ Network  http://192.168.101.15:4321/

01:17:01 [astro-icon] No icons detected!
Removing unexpected attribute on SVG: t
Removing unexpected attribute on SVG: p-id
Removing unexpected attribute on SVG: t
Removing unexpected attribute on SVG: p-id
Removing unexpected attribute on SVG: t
Removing unexpected attribute on SVG: p-id
C:/Users/Administrator/Documents/GitHub/nanarinostyl/node_modules/.pnpm/astro-icon@1.0.1/node_modules/astro-icon/components/Icon.astro:46
      const err = new Error(`Unable to locate "${name}" icon!`);
                  ^

Error: Unable to locate "logo/color/clover" icon!
    at eval (C:/Users/Administrator/Documents/GitHub/nanarinostyl/node_modules/.pnpm/astro-icon@1.0.1/node_modules/astro-icon/components/Icon.astro:46:19)
    at AstroComponentInstance.Icon [as factory] (C:/Users/Administrator/Documents/GitHub/nanarinostyl/node_modules/.pnpm/astro@3.6.4_@types+node@20.10.6_stylus@0.62.0/node_modules/astro/dist/runtime/server/astro-component.js:21:12)
    at AstroComponentInstance.init (C:/Users/Administrator/Documents/GitHub/nanarinostyl/node_modules/.pnpm/astro@3.6.4_@types+node@20.10.6_stylus@0.62.0/node_modules/astro/dist/runtime/server/render/astro/instance.js:39:29)
    at AstroComponentInstance.render (C:/Users/Administrator/Documents/GitHub/nanarinostyl/node_modules/.pnpm/astro@3.6.4_@types+node@20.10.6_stylus@0.62.0/node_modules/astro/dist/runtime/server/render/astro/instance.js:44:18)
    at Object.render (C:/Users/Administrator/Documents/GitHub/nanarinostyl/node_modules/.pnpm/astro@3.6.4_@types+node@20.10.6_stylus@0.62.0/node_modules/astro/dist/runtime/server/render/component.js:342:22)
    at Module.renderChild (C:/Users/Administrator/Documents/GitHub/nanarinostyl/node_modules/.pnpm/astro@3.6.4_@types+node@20.10.6_stylus@0.62.0/node_modules/astro/dist/runtime/server/render/any.js:36:17) {
  hint: 'The icon named "logo/color/clover" was not found in your local icon directory.\n' +
    '\n' +
    'Did you forget to configure your icon directory or make a typo?'
}

Node.js v18.16.0
 ELIFECYCLE  Command failed with exit code 1.

What's the expected result?

same behavior as v0

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-mbnz9k-cvs2zp?file=src%2Fpages%2Findex.astro

@nanarino nanarino changed the title Unable to locate "folder/folder/svg" icon [v1] Unable to locate "folder/folder/svg" icon Jan 1, 2024
natemoo-re added a commit that referenced this issue Jan 2, 2024
* fix(#178): match v0 name behavior for local icons

* chore: add changeset

* chore(lint): Prettier fix

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@seansmyth
Copy link

I'm still getting this error. It's really inconsistent though so might be a specific svg?

I've downloaded an example svg and it's loading with and without a subdirectory.

However, the logo I want to use is throwing an error:
Screenshot 2024-01-11 at 15 34 22
Screenshot 2024-01-11 at 15 33 36 copy

@seansmyth
Copy link

Weirdly, if I do a build and then go back to dev mode it seems to work? I don't know if that helps at all

@ghost
Copy link

ghost commented Jul 17, 2024

facing the same problem and building then running dev mode makes it work for some reason

@david-ouatedem
Copy link

had this same issue, restarting the dev server worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants