Skip to content

Does not seem to work in libraries #402

@thomasqbrady

Description

@thomasqbrady

Describe the bug

Similar to: #378 (comment)

We're using SvelteKit with Svelte 4 for context.

We publish a component library on our team. We want to use unplugin-icons in that library, as well as in the projects which consume that library. Currently we can build the component library just fine, but when we try to use the components in a another project we get:

✘ [ERROR] Could not resolve "~icons/tabler/menu-2"
node_modules/[our component library][a component].svelte:47:22:
      47 │ import IconMenu2 from "~icons/tabler/menu-2";

Reproduction

Create library using unplugin-icons. Use that library in another project and attempt to build.

System Info

System:
    OS: macOS 15.4.1
    CPU: (14) arm64 Apple M3 Max
    Memory: 167.67 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.8.0 - ~/.nvm/versions/node/v22.8.0/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v22.8.0/bin/npm
  Browsers:
    Chrome: 135.0.7049.115
    Safari: 18.4

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions