Skip to content
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

More efficient imports #53

Open
mbrevda opened this issue Oct 30, 2022 · 6 comments
Open

More efficient imports #53

mbrevda opened this issue Oct 30, 2022 · 6 comments

Comments

@mbrevda
Copy link

mbrevda commented Oct 30, 2022

When importing an icon using a destructuring (i.e. with named imports), it seems necessary (at least for some compilers?) to transverse the entire list of icons. This can lead to a relatively large performance penalty vs default exports. Here is feedback from one compiler and some ideas on how this can be improved.

@leMaik
Copy link
Member

leMaik commented Oct 30, 2022

Apparently someone already changed this repo to make it more efficient, so... PR?

@mbrevda
Copy link
Author

mbrevda commented Oct 30, 2022

I don't have that code, but it seems pretty straightforward (assuming you'd be happy with esbuild). Are you ok with having all the icons inlined to a single file? (while improving bundle speed, which will effectively duplicate the package size)

@leMaik
Copy link
Member

leMaik commented Oct 30, 2022

Not sure about that. I just checked @mui/material-icons and they also have one icon per file and re-exports in the index file. Webpack handles "pure" modules just fine and can optimize it ("sideEffects": false in the package.json file).

Sounds like a bundler issue to me, not like an issue that library maintainers should handle. 🤔

@mbrevda
Copy link
Author

mbrevda commented Oct 30, 2022

If this isn't project related, feel free to close.
Would you care to comment on the original issue and see if there is some way forward here?

@leMaik
Copy link
Member

leMaik commented Oct 30, 2022

@mbrevda I did, but the issue over there is already closed. Apparently it's not an esbuild issue.

@mbrevda
Copy link
Author

mbrevda commented Oct 30, 2022

thanks!

@mbrevda mbrevda closed this as completed Oct 30, 2022
@leMaik leMaik reopened this Oct 30, 2022
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

No branches or pull requests

2 participants