-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
switch hex-rgb to polished parseToRgb #18681
Conversation
Thanks for jumping on this so quickly. One downside here is that it's about a 1400% size increase from I can plan to look a little closer in my morning. It'd be good to have this resolved in time for next week's release, so if it comes down to it, we can live with the larger bundle until another solution presents itself. |
Yeah if treeshaking isn't supported its a big hit. I can see a few alternatives but they're only 50% better:
|
@@ -2,7 +2,7 @@ | |||
* External dependencies | |||
*/ | |||
import { get } from 'lodash'; | |||
import hexRgb from 'hex-rgb'; | |||
import { parseToRgb } from 'polished'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we already have tinycolor2 in our bundles. We could use it instead right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jameslnewell Ah, you folks are so fast! You jumped on this before I could :)
I was going to suggest using tinycolor2
since it was already there. My apologies for not realizing that when I submitted my original PR.
Thanks for the heads up @youknowriad + @aduth !
Based on what I see in that link, it's not very well tree-shaken, since the total bundle is 10.8kb gzipped, and the single I've pushed up a change here to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming latest changes look good to you, I think we can merge this 👍
Description
Temporary fix for the issue discussed in #17963 (comment)
Replaced the
hex-rgb
package+function forpolished
'sparseToRgb
function since thehex-rgb
package doesn't provide any transpiled modules.Polished is 10kb gziped but highly treeshakable.
How has this been tested?
Ran unit tests, checked the storybooks.
Screenshots
No visual changes.
Types of changes
Bug fix.
Checklist:
closes #18719