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

Tree shaking #3

Closed
lednhatkhanh opened this issue Oct 19, 2020 · 7 comments
Closed

Tree shaking #3

lednhatkhanh opened this issue Oct 19, 2020 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@lednhatkhanh
Copy link

lednhatkhanh commented Oct 19, 2020

The whole package will be included when I import any icons from phosphor-react.

Could you please consider supporting tree shaking? Thank you.

@rektdeckard
Copy link
Member

rektdeckard commented Oct 22, 2020

@lednhatkhanh looks like a regression when we switched to using Parcel Rollup, I'll make sure it's fixed up in the next release!

@rektdeckard rektdeckard added the enhancement New feature or request label Oct 22, 2020
@rektdeckard rektdeckard self-assigned this Oct 22, 2020
@devrnt
Copy link

devrnt commented Nov 15, 2020

Seems like the ES module export is not discovered according to bundlephobia: https://bundlephobia.com/result?p=phosphor-icons@1.0.1

@rektdeckard
Copy link
Member

@devrnt that's the vanilla JS lib you're inspecting, not the React lib

@devrnt
Copy link

devrnt commented Nov 15, 2020

@rektdeckard Oops my bad, thanks to point out

@rektdeckard rektdeckard added bug Something isn't working and removed enhancement New feature or request labels Nov 15, 2020
@devrnt
Copy link

devrnt commented Nov 16, 2020

Seems like same behaviour is occuring in a default nextjs project. (see README.md)

https://github.com/devrnt/nextjs-phosphor-react

  • Branch master conains the size of next build without the use of phosphor-react.
  • Branch phosphor-react has an import of the Hand component from phosphor-react in pages/index.js.

TLDR: First load JS size

  • without use of phosphor-react: 65.1 kB
  • with phosphor-react: 285 kB (even when just using one icon, all icons are included in bundle)

@devrnt
Copy link

devrnt commented Nov 18, 2020

Has been fixed for me in version 1.0.1

@rektdeckard
Copy link
Member

Yep, fixed up Rollup config in 78dec00. Glad to hear it's working for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants