-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
Transpile lib to more modern JS #126
Comments
Related: #132 |
Just showing some support for this — any efforts to lower the bundle size is much appreciated! 22kB minified is a pretty big bundle for this simple (but necessary) utility |
Thanks @jzxhuang! I'm also looking for more opportunities to reduce the bundle size. The default config has by far the biggest impact on bundle size (75% of gzipped lib), so the biggest improvement could be to create that automatically based on the Tailwind classes actually used in the codebase. I have an open discussion about this in the Tailwind repo. But so far no movement there. |
I found that optional chaining not transformed to es5, so it cannot support chrome version less than 80
|
@yuuk True, I see it as well. Is this causing an issue for you? Note to myself:
|
Yes, Some app's build-in browser may use low version Chrome core, like Alipay、WhatsApp, The problem I have encountered is that I open my project in Alipay Android build-in browser it causing an error. |
Wrote down some thoughts on how to improve bundling in #283 (comment) which I could do as part of this as well. |
Targets should only be modernized in // To be enabled in #126
This was addressed in release v2.0.0. |
Currently the library is transpiled with the default browserslist config which means it is transpiled to ES5.
I played around with some more modern configs like
last 3 years and > 0.1%, maintained node versions
and could reduce the minified library size by 1 kB and the gzipped size by 0.5 kB. Additionally, I expect some minor performance improvements because e.g. rest/spread isn't polyfilled anymore.Transpiling to more modern JS could be a breaking change for some users of tailwind-merge, so this would need to go into a v2 release of tailwind-merge.
I could also provide an additional legacy build (
import { twMerge } from 'tailwind-merge/legacy'
) which stays transpiled to ES5 since everything in tailwind-merge can be polyfilled. But I guess that's not necessary since devs who need to support ES5 probably transpile their dependencies these days anyway.The text was updated successfully, but these errors were encountered: