colorjoe icon indicating copy to clipboard operation
colorjoe copied to clipboard

Import colorjoe using 'import' keyword

Open foregrow opened this issue 3 years ago • 1 comments

Is it possible to import colorjoe using 'import' keyword?

I tried importing its all contents using: import * as colorjoe from 'colorjoe'; and as default: import colorjoe from 'colorjoe'; but it did not work

Actually I get TypeError: Cannot set properties of undefined (setting 'colorjoe')

foregrow avatar May 27 '22 09:05 foregrow

Can you provide a simple reproduction (i.e. with Node version etc.)?

I think the problem is that the library was written before ES2018 existed and it has been packaged within a UMD wrapper. To solve, we would have to extend rollup configuration and likely leverage the module field.

A PR would be highly welcome as I don't maintain the package actively anymore and many options have showed up. If I was writing it now, likely I would do composition differently etc. although the core idea of using CSS for gradients is solid.

bebraw avatar May 27 '22 14:05 bebraw