natemoo-re / astro-icon

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

Sub-folders icons doesn't work unless the dev server restarted #204

Open FairyPenguin opened 4 months ago

FairyPenguin commented 4 months ago

What version of astro-icon are you using?

"^1.0.2"

Astro Info

> astro "info"

Astro                    v4.3.1
Node                     v20.9.0
System                   Linux (x64)
Package Manager          pnpm
Output                   server
Adapter                  none
Integrations             @astrojs/react
                         astro-icon

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

No response

Describe the Bug

I followed the guide from the docs Here: https://www.astroicon.dev/getting-started/

to organize my icons I add them in a subfolder, but once I add a new SVG file, It's not detected by the Astro path as the module is not found the only solution is to restart the dev server

Note: I use inline SVG, I paste the code in .SVG file and use it like this

import { Icon } from 'astro-icon/components' <Icon name='product/CartSvg' width={24} height={24} /> The Folder looks like this src/icons/*/ image

Error: 02:04:58 [ERROR] Unable to locate "product/CartSvg" icon!

What's the expected result?

As I understand it should be detected and can be used without the need to restart every time I add a new SVG Icon.

Link to Minimal Reproducible Example

https://github.com/FairyPenguin/astro-reproduce

FairyPenguin commented 4 months ago

EvenIcons in the src/icons folder directly affected too