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

Reduce size of bundle #41

Open
reichert621 opened this issue Sep 3, 2020 · 3 comments
Open

Reduce size of bundle #41

reichert621 opened this issue Sep 3, 2020 · 3 comments

Comments

@reichert621
Copy link
Collaborator

A couple things to try:

  • find a bundle analyzer to let us know what dependencies are the largest
  • try switching from react to preact
  • remove all unused code!

Anything else?

@osdiab
Copy link

osdiab commented Mar 21, 2021

bundle analyzer: would source-map-explorer work?

Bundlephobia: https://bundlephobia.com/result?p=@papercups-io/chat-widget@1.1.9

looks pretty large, probably less than it actually is given tree-shaking. Is the library side-effect free? if so, would make sense to add that annotation to package.json.

Some thoughts on bundle size reduction:

  • yeah, preact would make sense
  • perhaps replacing emotion with something like compiled CSS in JS would remove its runtime: https://compiledcssinjs.com/
  • Is framer + popmotion needed for the animations or can they be done equivalently with pure CSS?
  • Is superagent needed or can this just use normal Fetch? not sure about backwards-compatibility requirements.

@reichert621
Copy link
Collaborator Author

het @osdiab! yep, framer and superagent can likely be removed in favor of pure CSS + fetch 👍

@osdiab
Copy link

osdiab commented Mar 22, 2021

at a minimum users can also configure on their own with webpack aliases that react imports get resolved by preact/compat, though it's less than ideal since things may not be 100% in-sync between them, potential for some bugs doing that. I'm not a user of papercups yet so I'm probably not going to invest the effort at the moment to make this contribution, but would do a lot to assuage my worries about adoption (and perhaps others too) if bundlephobia made it look nice and tiny!

Idk if this library is side-effect free but if it is would also help to put that annotation in package.json to assist tree-shaking and external tools like bundlephobia's es6 imports analysis.

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