icons-pack / react-simple-icons

📦 This package provides the Simple Icons packaged as a set of React components.
MIT License
313 stars 19 forks source link

Can tree shaking be improved for named imports? #32

Closed pomali closed 4 years ago

pomali commented 4 years ago

If I import

import { Github } from "@icons-pack/react-simple-icons";

webpack packs whole library (2MB+).

If i import only one file

import  Github  from "@icons-pack/react-simple-icons/lib/Github";

only icon I need (few kB).

I would expect for named imports to get tree shaken and pack only files that are needed.

Thanks for the lib, btw ;)

wootsbot commented 4 years ago

This is a good idea, we should only pack the components we need

@pomali I will leave it as a priority for the future version

andrewmclagan commented 4 years ago

yeah our build was BLOWN out by this package - we assumed tree shaking would work.

Until then perhaps docs in the imports?

wootsbot commented 4 years ago

@andrewmclagan I'm working on it.

wootsbot commented 4 years ago

Until then perhaps docs in the imports?

I did not understand very well this sorry

wootsbot commented 4 years ago

@pomali We have a Pr #39 with the fix of the issue that I report.

Thanks @pomali for your issue, any collaboration is free to contribute whatever it wants.

wait for the new version...

wootsbot commented 4 years ago

@pomali @andrewmclagan

has been released version 3.0.0-alpha.0, let's test this version before launching the stable version.

results in https://bundlephobia.com

pomali commented 4 years ago

Version 3.0.0-alpha.0 looks fine to me, tree shaking works. :)

wootsbot commented 4 years ago

Version 3.0.0-alpha.0 looks fine to me, tree shaking works. :)

enjoy the version v3.0.0