lucide icon indicating copy to clipboard operation
lucide copied to clipboard

Importing all icons with star operator

Open MichaelCasaDev opened this issue 1 year ago • 1 comments

Package

  • [ ] lucide
  • [ ] lucide-angular
  • [ ] lucide-flutter
  • [ ] lucide-preact
  • [X] lucide-react
  • [ ] lucide-react-native
  • [ ] lucide-solid
  • [ ] lucide-svelte
  • [ ] lucide-vue
  • [ ] lucide-vue-next
  • [ ] Figma plugin
  • [ ] source/main
  • [ ] other/not relevant

Version

0.303.0

Browser

  • [ ] Chrome/Chromium
  • [ ] Firefox
  • [ ] Safari
  • [ ] Edge
  • [ ] iOS Safari
  • [ ] Opera
  • [X] Other/not relevant

Operating system

  • [ ] Windows
  • [ ] Linux
  • [ ] macOS
  • [X] Other/not relevant

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

  • [X] I have searched if someone has submitted a similar issue before and there weren't any. (Please make sure to also search closed issues, as this issue might already have been resolved.)

MichaelCasaDev avatar Feb 13 '24 07:02 MichaelCasaDev

IMO we should just drop the index file in v2.

jguddas avatar Feb 13 '24 08:02 jguddas