Skip to content

SvelteKit Library import error #378

@vdawg-git

Description

@vdawg-git

Describe the bug

It fails to resolve unplugin icons in a component imported from a UI library/dependency.
Edit: This is during dev and build.

 [ERROR] Could not resolve "virtual:icons/mingcute/close-line"

    ../../node_modules/.pnpm/@..@0.0.1-rc.32_@types+node@22.7.0_@vue+compiler-sfc@3.5.8_jiti@1.21.6_postcss-load-_hbmxqbqxr2ktizjeyao532r5he/node_modules/@../ui/dist/Notification/Notification.svelte:42:22:
      42  import IconClose from "virtual:icons/mingcute/close-line";
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "virtual:icons/mingcute/close-line" as external to exclude it from the
  bundle, which will remove this error and leave the unresolved path in the bundle.

Reproduction

Consumer:
https://github.com/vdawg-git/unplugin-icon-issue-consumer

Minimal library repo:
https://github.com/vdawg-git/unplugin-icons-issue

System Info

  System:
    OS: Linux 6.10 EndeavourOS
    CPU: (16) x64 13th Gen Intel(R) Core(TM) i7-1360P
    Memory: 13.95 GB / 31.07 GB
    Container: Yes
    Shell: 3.7.1 - /bin/fish
  Binaries:
    Node: 22.9.0 - /usr/bin/node
    npm: 10.8.3 - /usr/bin/npm
    pnpm: 9.11.0 - /usr/bin/pnpm
    bun: 1.1.29 - /usr/bin/bun
  Browsers:
    Brave Browser: 129.1.70.117

Used Package Manager

pnpm

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