lucide-icons / lucide

Beautiful & consistent icon toolkit made by the community. Open-source project and a fork of Feather Icons.
https://lucide.dev
ISC License
11.2k stars 507 forks source link

Aliased `lucide-svelte` importing icons directly gives module not found error #2490

Closed SenneVanderAuwera closed 3 days ago

SenneVanderAuwera commented 1 month ago

Package

Version

0.445.0

Can you reproduce this in the latest version?

Browser

Operating system

Description

When trying to import an icon directly using the lucide-svelte library, vscode throws the following error:

Cannot find module 'lucide-svelte/icons/alert-circle' or its corresponding type declarations.js(2307)

Steps to reproduce

<script>
    import AlertCircle from "lucide-svelte/icons/alert-circle";
</script>

<AlertCircle color="#ff3e98" />

Checklist

karsa-mistmere commented 1 month ago

Hi @SenneVanderAuwera,

The docs are not quite up to date, so there's an old name hiding there. The trouble is, you may only import icons directly when using their canonical names, so it should be:

<script>
    import CircleAlert from "lucide-svelte/icons/circle-alert";
</script>

<CircleAlert color="#ff3e98" />
SenneVanderAuwera commented 1 month ago

Thanks, that solves it.