I use colorthief in node environment and I use webpack.
But webpack seems to take the wrong dist file (browser version color-thief.mjs instead node version color-thief.js ?), I get errors like TypeError: colorthief__WEBPACK_IMPORTED_MODULE_0__.default.getColor is not a function or ReferenceError: document is not defined (Node and browser version seems to differ in export)
I can fix with import colorThief from "colorthief/dist/color-thief.js"; in my code
But I have the same issue with the quantize module (TypeError: quantize is not a function) using in colorthief (takes browser version index.mjs instead node version index.js ?)
I patch this like follow for me (dist only), but it will not works anymore in the current and common use case of colorthief, I think ...
I use colorthief in node environment and I use webpack.
But webpack seems to take the wrong dist file (browser version
color-thief.mjs
instead node versioncolor-thief.js
?), I get errors likeTypeError: colorthief__WEBPACK_IMPORTED_MODULE_0__.default.getColor is not a function
orReferenceError: document is not defined
(Node and browser version seems to differ in export)I can fix with
import colorThief from "colorthief/dist/color-thief.js";
in my codeBut I have the same issue with the
quantize
module (TypeError: quantize is not a function
) using in colorthief (takes browser versionindex.mjs
instead node versionindex.js
?)I patch this like follow for me (dist only), but it will not works anymore in the current and common use case of colorthief, I think ...