Skip to content

🎇 Swap destructured imports from lucide for direct imports per icon #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 26, 2025

Conversation

ansballard
Copy link
Contributor

the template is using lucide-react icons, which in production is tree shaken. But in dev, they pull the full 1.23mb file, vs ~2kb per icon if they're referenced directly. Updating these references to be direct imports will save almost the entire 1.23mb, is still legible, and does not affect prod bundle size.

Screenshot 2025-06-26 at 2 15 23 PM

…ce vite doesn't tree shake in dev mode and the library is >1mb
@Copilot Copilot AI review requested due to automatic review settings June 26, 2025 20:18
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces destructured imports from lucide-react with direct icon imports to reduce the development bundle size by avoiding the full 1.23mb file load. Key changes include:

  • Updating icon imports in various UI components to directly reference individual icon modules.
  • Consolidating the import paths across multiple files to improve development performance.

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/components/ui/sidebar.tsx Updated PanelLeftIcon to a direct import from lucide-react/dist/esm/icons.
src/components/ui/sheet.tsx Updated XIcon to a direct import from lucide-react/dist/esm/icons.
src/components/ui/select.tsx Replaced destructured imports with direct imports for CheckIcon, ChevronDownIcon, and ChevronUpIcon.
src/components/ui/resizable.tsx Updated GripVerticalIcon import to a direct module.
src/components/ui/radio-group.tsx Changed CircleIcon import to a direct module.
src/components/ui/pagination.tsx Updated imports for ChevronLeftIcon, ChevronRightIcon, and MoreHorizontalIcon to direct imports with semicolon usage.
src/components/ui/navigation-menu.tsx Updated ChevronDownIcon to a direct import.
src/components/ui/menubar.tsx Replaced destructured imports with direct imports for CheckIcon, ChevronRightIcon, and CircleIcon.
src/components/ui/input-otp.tsx Updated MinusIcon import to a direct module.
src/components/ui/dropdown-menu.tsx Changed imports for CheckIcon, ChevronRightIcon, and CircleIcon to direct modules.
src/components/ui/dialog.tsx Updated XIcon import to a direct module.
src/components/ui/context-menu.tsx Replaced destructured imports with direct imports for CheckIcon, ChevronRightIcon, and CircleIcon.
src/components/ui/command.tsx Updated SearchIcon import to a direct module.
src/components/ui/checkbox.tsx Changed CheckIcon import to a direct module.
src/components/ui/carousel.tsx Updated ArrowLeft and ArrowRight imports to direct modules.
src/components/ui/calendar.tsx Updated ChevronLeft and ChevronRight imports to direct modules.
src/components/ui/breadcrumb.tsx Changed imports for ChevronRight and MoreHorizontalIcon to direct modules.
src/components/ui/accordion.tsx Updated ChevronDownIcon import to a direct module.

@ansballard ansballard merged commit de19d27 into main Jun 26, 2025
3 checks passed
@ansballard ansballard deleted the ansballard/direct-esm-imports-for-icons branch June 26, 2025 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants