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
10.58k stars 481 forks source link

Importing all icons with star operator #1888

Open MichaelCasaDev opened 7 months ago

MichaelCasaDev commented 7 months ago

Package

Version

0.303.0

Browser

Operating system

Description

Importing icons via a start operator like import * as icons from 'lucide-react' instead of using import { icons } from 'lucide-react'results in two different icons objects. The one via start operator has 49 more icons that the actual import suggested by the docs here.

The following are the icons that can't be imported via import { icons } ...:

"alarmcheck",
"alarmminus",
"alarmplus",
"booktemplate",
"circleslashed",
"columns",
"curlybraces",
"edit",
"edit2",
"edit3",
"filecog2",
"foldercog2",
"gitcommit",
"grid",
"inspect",
"layout",
"panelbottominactive",
"panelleftinactive",
"panelrightinactive",
"panelsleftright",
"panelstopbottom",
"paneltopinactive",
"penbox",
"rows",
"sendhorizonal",
"shieldclose",
"sidebar",
"sidebarclose",
"sidebaropen",
"sortasc",
"sortdesc",
"squaregantt",
"squarekanban",
"squarekanbandashed",
"stars",
"textselection",
"train",
"user2",
"usercheck2",
"usercircle",
"usercircle2",
"usercog2",
"userminus2",
"userplus2",
"users2",
"usersquare",
"usersquare2",
"userx2",
"verified",

Steps to reproduce

  1. import icons using a start operator import * as icons from 'lucide-react'
  2. get a list of all icons, use Object.keys(icons).filter((key) => !key.startsWith("Lucide") || !key.endsWith("Icon")) as Array<keyof typeof icons>
  3. import icons using icons object export import { icons } from 'lucide-react'
  4. compare the first list with this one Object.keys(icons)

Result first list will have 49 more icons than the second one

Checklist

jguddas commented 7 months ago

IMO we should just drop the index file in v2.