Skip to content

docs: add deep import recommendation for lucide-react #3397

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

youknowom
Copy link

Description

πŸ“„ This pull request adds a section to the README.md file recommending deep imports for lucide-react.

βœ… Example added:

// βœ… Recommended
import VideoIcon from 'lucide-react/icons/video';

// ❌ Not recommended
import { VideoIcon } from 'lucide-react';

Copy link
Member

@jguddas jguddas left a comment

Choose a reason for hiding this comment

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

It's quite niche to not have bundler support for this, make it so you explicitly mention which bundlers this is needed for.

@youknowom youknowom requested a review from jguddas July 8, 2025 13:52
@youknowom
Copy link
Author

Thanks @jguddas for the feedback! I’ve added the bundler clarification as suggested. Let me know if anything else needs updating


## ⚠️ Importing Icons in React

To keep your bundle size optimized, we recommend importing icons using **deep imports**. This ensures only the icons you use are included in your final build.
Copy link
Member

Choose a reason for hiding this comment

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

This is also not what I would recommend, I would recommend you use a bundler / plugin to tree shake your barrel imports.

That's why the text "we recommend" doesn't make me particularly happy, direct imports are a hack that I would prefer people would avoid.

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