jakoivis / color-util

Color utilities with format conversions and gradients
MIT License
7 stars 1 forks source link

Doesn't work in NodeJS #8

Open alexkreidler opened 1 year ago

alexkreidler commented 1 year ago

Got a window is undefined error, which suggests it was written for browser environments.

webpack://colorutil/webpack/universalModuleDefinition:10
})(window, function() {
   ^
ReferenceError: window is not defined
    at Object.<anonymous> (webpack://colorutil/webpack/universalModuleDefinition:10:4)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Object.require.extensions.<computed> [as .js] (/root/.local/share/pnpm/global/5/.pnpm/ts-node@10.9.1_@types+node@20.2.3_typescript@5.0.4/node_modules/ts-node/src/index.ts:1608:43)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
cxr932 commented 2 months ago

I was just coming here to open this issue. Thanks @alexkreidler.

For anyone else coming here with this problem, version 2.2.1 does not have this issue and works in NodeJS.