switch hex-rgb to polished parseToRgb#18681
switch hex-rgb to polished parseToRgb#18681youknowriad merged 3 commits intoWordPress:masterfrom jameslnewell:fix-hex-rgb
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:
|
| */ | ||
| import { get } from 'lodash'; | ||
| import hexRgb from 'hex-rgb'; | ||
| import { parseToRgb } from 'polished'; |
There was a problem hiding this comment.
I think we already have tinycolor2 in our bundles. We could use it instead right?
There was a problem hiding this comment.
@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 |
aduth
left a comment
There was a problem hiding this comment.
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-rgbpackage+function forpolished'sparseToRgbfunction since thehex-rgbpackage 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