bebraw/colorjoe

Import colorjoe using 'import' keyword

foregrow opened this issue · 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')

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.