Closed leonsilicon closed 1 year ago
I'm getting the same issue when using https://github.com/sindresorhus/ora since it has chalk as a dependency
Also getting this issue. I used a package.json
pnpm.override
to "chalk": "4.1.2"
to work around this problem.
It seems like tsm doesn't support subpath imports yet?
Same issue
Created a Replit for this here:
https://replit.com/@karlhorky/tsm-chalk-5-example#package.json
This confirms that the problem is also present with an updated esbuild@0.14.54
, which is the latest version of esbuild
matching tsm
's semver range:
https://github.com/lukeed/tsm/blob/2fd630db070625c64cd2b10d49700c942e12105e/package.json#L36
Same error with tsm v2.3.0
(node:42830) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:42830) DeprecationWarning: Obsolete loader hook(s) supplied and will be ignored: getFormat, transformSource
/Users/user/Developer/azat-io/node_modules/.pnpm/chalk@5.1.2/node_modules/chalk/source/index.js:8
const {stdout: stdoutColor, stderr: stderrColor} = supportsColor;
^
TypeError: Cannot destructure property 'stdout' of 'supportsColor' as it is undefined.
at <anonymous> (/Users/user/Developer/azat-io/node_modules/.pnpm/chalk@5.1.2/node_modules/chalk/source/index.js:8:16)
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v19.1.0
First of all, thanks for this amazing project!
I noticed that tsm fails to import dependencies from chalk 5, giving the following error:
It seems like the chalk
supportsColor
import is becomingundefined
, and I believe it has something to do with how chalk imports its dependencies:Here is a GitHub repo that reproduces this error: https://github.com/leonzalion/tsm-bug Node version: 16.13.2
Let me know if this is a
tsm
bug and/or if there's a workaround to this issue!