bgrins / TinyColor

Fast, small color manipulation and conversion for JavaScript
https://bgrins.github.io/TinyColor/
MIT License
5.05k stars 439 forks source link

fix: replace "const" with "var" #263

Closed dongyuanxin closed 1 year ago

dongyuanxin commented 1 year ago

Screenshot

image

We installed the latest version in the node_modules/ folder. And ES6 syntax exists, shown as the screenshot.

What's the problem?

ES6 syntax triggers some tool in CI process, and it failed finally.

What did I do?

Replace "const" with "var".

So it will have better browser compatibility.

bgrins commented 1 year ago

Ideally we could handle this in the build step (https://github.com/bgrins/TinyColor/blob/master/build.js#L4) so the main source can continue to use (and expand usage of) modern features, but the built artifacts can support older configurations. I'll take a look at that later and see if I can figure it out. In the meantime if you use tinycolor2@1.4.2 it will still have the older var declaration.

bgrins commented 1 year ago

I landed an alternative fix for this in https://github.com/bgrins/TinyColor/pull/266 (transpiling the code with babel so we can use more ES6 in the source). Thanks for sending this over though

bgrins commented 1 year ago

@dongyuanxin this should be fixed for you on the latest version on npm, let me know if it isn't