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

Usage w/o Emotion #208

Closed
ioanlucut opened this issue Jun 24, 2020 · 12 comments
Closed

Usage w/o Emotion #208

ioanlucut opened this issue Jun 24, 2020 · 12 comments

Comments

@ioanlucut
Copy link

First, thanks for the lib!

However, it uses Emotion (https://github.com/davidhu2000/react-spinners/blob/master/package.json#L93) which means an extra bundle of JS for any app which does not use that framework by default.

I would love to use this without having the extra payload in our bundle.

Would this be an option?

@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.69. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@mnlbox
Copy link

mnlbox commented Jul 8, 2020

@ioanlucut Yeah, I have same issue. I prefer a smaller bundle size. Your final bundle size now is a little huge and not fit good for production:
https://bundlephobia.com/result?p=react-spinners@0.9.0

@davidhu2000 any plan to fix this issue and decrease bundle size?

@davidhu2000
Copy link
Owner

@ioanlucut can you provide more details on your application setup? so I can create a version locally to test. If you'd like more details on why emotion was added. It was done for cleaner code and server side rendering #5

@davidhu2000
Copy link
Owner

@mnlbox, how are you importing the loaders? You can import them individually, which should help reduce bundle size.

import BarLoader from 'react-spinners/BarLoader';`

It's also possibly related to #188

@ioanlucut
Copy link
Author

@davidhu2000 currently we use SCSS, so the emotion is not used at all in the codebase.

Thinking out loud: maybe a solution is to use emotion but provide a dist version of the spinners with the compiled inline CSS while tree shaking everything else.

@AmirAsghary
Copy link

+1 bump

1 similar comment
@sn4f
Copy link

sn4f commented Nov 29, 2021

+1 bump

@davidhu2000
Copy link
Owner

this seems to be the most viable solution https://stackoverflow.com/a/71102920/6496010, but it'll require a ton of rewrites.

@davidhu2000
Copy link
Owner

ok, published alpha version for BarLoader without emotion, give it a try. v0.13.0-alpha.1

one note: you'd need to add

<BarLoader css={{ display: 'block' }} />

to have it show up properly. will be fixed later

@davidhu2000
Copy link
Owner

https://bundlephobia.com/package/react-spinners@0.13.0-alpha.3
Screen Shot 2022-05-16 at 8 07 01 AM

https://bundlephobia.com/package/react-spinners@0.12.0
Screen Shot 2022-05-16 at 8 07 08 AM

wow, removing emotion make a huge difference in size

@davidhu2000
Copy link
Owner

ok, this is published as 0.13.0-alpha.5.

@davidhu2000
Copy link
Owner

going to close this real for now, please let me know if there are issues. hopefully release 0.13 by next week

@davidhu2000 davidhu2000 moved this from In progress to Done in 0.13 May 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
0.13
Done
Development

No branches or pull requests

5 participants