natemoo-re / astro-icon

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

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

Closed nanarino closed 6 months ago

nanarino commented 6 months ago

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

seansmyth commented 5 months ago

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 commented 5 months ago

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