lokesh / color-thief

Grab the color palette from an image using just Javascript. Works in the browser and in Node.
https://lokeshdhakar.com/projects/color-thief/
MIT License
12.34k stars 1.31k forks source link

ColorThief ES6 import is broken #240

Closed mikemaccana closed 1 year ago

mikemaccana commented 1 year ago

Per the docs:

import ColorThief from './node_modules/colorthief/dist/color-thief.mjs'

This isn't a normal ES6 module, which should load automatically based on the module setting in package.json, eg import ColorThief from 'colorthief'.

It sounds like the instructions are a workaround for a badly set module value in package.json or an odd build process, but even playing with these I (and others, based on StackOverflow) can't get colorthief to work.

When I follow the instructions:

ColorThief.toString()
'function(){}'`