tailwind-merge
tailwind-merge copied to clipboard
Transpile lib to more modern JS
Note If you are affected by this, please let me know in a comment.
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 anyway these days.
Related: https://github.com/dcastil/tailwind-merge/issues/132