Closed dongyuanxin closed 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.
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
@dongyuanxin this should be fixed for you on the latest version on npm, let me know if it isn't
Screenshot
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.