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] Confusing "No icons detected!" message #176

Closed
srflp opened this issue Dec 29, 2023 · 1 comment · Fixed by #180
Closed

[v1] Confusing "No icons detected!" message #176

srflp opened this issue Dec 29, 2023 · 1 comment · Fixed by #180

Comments

@srflp
Copy link

srflp commented Dec 29, 2023

What version of astro-icon are you using?

v1.0.1

Astro Info

Astro                    v4.0.8
Node                     v20.9.0
System                   macOS (arm64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/tailwind
                         astro-icon
                         @astrojs/sitemap

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

No response

Describe the Bug

During build or starting a dev server without collections, but with icons in src/icons folder, the message "No icons detected!" gets printed. This is quite misleading, because in my case icons from src/icons were detected and displayed correctly.

What's the expected result?

The message should be more like "No collection icons detected!"

Link to Minimal Reproducible Example

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

@brentarias
Copy link

brentarias commented Jan 1, 2024

I have the same problem, except that the icons cannot be referenced.

04:32:59 PM [astro-icon] No icons detected!
 error   Unable to locate "logos/youtube" icon!

The youtube.svg file is present. I don't know why it is not detected. My configuration:

  "dependencies": {
    "@astro-community/astro-embed-youtube": "^0.4.1",
    "@astrojs/mdx": "^1.1.3",
    "@astrojs/rss": "^2.4.3",
    "@astrojs/sitemap": "^1.3.2",
    "@sanity/astro": "2.1.1",
    "@sanity/client": "^6.4.12",
    "@sanity/image-url": "^1.0.2",
    "astro": "^3.4.0",
    "astro-icon": "^1.0.1",
    "astro-portabletext": "^0.9.6",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "sanity": "*"
  }

I am using pnpm and node 18.18.0.

I found I can solve or circumvent the problem if I explicitly configure the default path:

    icon({iconDir: "src/icons"})]

The above "fix" only works if I don't use any subfolders under "src/icons". So my reference must look like <Icon name="youtube" /> instead of <Icon name="logos/youtube" />.

natemoo-re added a commit that referenced this issue Jan 2, 2024
* fix(#176): removes warning when no icon packs are found

* chore(lint): Prettier fix

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.

2 participants