question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Component auto import doesn't work with custom icons

See original GitHub issue

I can’t get custom icon auto component import to work with unplugin-icons. I have a folder with svgs and I use the FileSystemIconLoader helper to load the icons. As soon, as I explicitly import the icons with

import Ghost from '~icons/custom-icons/ghost'

it works, but eventhough I added the following to the Components configuration, it doesn’t load the components

    Components({
      dts: true,
      resolvers: [
        IconsResolver({
          customCollections: ['custom-icons'],
        }),
      ],
    }),

Here is a reproduction repo based on vitesse-lite and two fontawesome free icons as example: https://github.com/itpropro/unplugin-icons-repro

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:12

github_iconTop GitHub Comments

1reaction
itproprocommented, Jun 9, 2022

Thanks for you detailed exploration @userquin that helped a lot! Lot’s of stuff, I didn’t find in the documentation, as soon as I integrated this, I will create a little docs PR 📜 The packages were indeed quite old and some basic configuration missing as the repo was created in a few minutes in march 😅

1reaction
userquincommented, May 9, 2022

also working importing 1 of the icons on src/pages/index.vue , you can check the syntax changes:

imagen

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Icons · Issue #12 · antfu/unplugin-icons - GitHub
I know since the icons are my own, I can just pack them in the project or create my own component to load...
Read more >
not able to auto import react components from node modules
Based on my testing, the auto-import functionality built into VS Code only works for symbols defined in files that are already loaded as...
Read more >
unplugin-icons - npm
Import icons names with the convension ~icons/{collection}/{icon} and use them directly as components. Auto importing is also possible. React.
Read more >
Auto Import | IntelliJ IDEA Documentation - JetBrains
Insert imports on paste. Select how IntelliJ IDEA should process references to missing classes, static methods, or fields in pasted blocks ...
Read more >
unplugin-icons/README.md - UNPKG
17, - [Custom icons](#custom-icons) - load your custom icons to get universal ... 18, - [Auto Importing](#auto-importing) - Use icons as components ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found