You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just reported this to ts-node (TypeStrong/ts-node#2148), but thought that the problem might lie on the Yarn PNP's side and you guys could take a look. Following is a copy of that bug report:
Search Terms
ts-node, esm, ts-node-esm, yarn-pnp
Expected Behavior
Given:
A TypeScript project...
...using ESM...
...and relative imports with extensions (as recommended for ESM)...
...with dependencies managed with Yarn PNP (and its own Node loader registered in runtime)
I shouldn't have problems running this TypeScript code with ts-node:
import { a } from './lib/a.js';
Command (actually a package.json script) being used:
$ yarn run test
(node:12796) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
node:internal/modules/run_main:123
triggerUncaughtException(
^
Error: Qualified path resolution failed: we looked for the following paths, but none could be accessed.
Source path: D:\dev\repro-ts-node-esm-yarn-pnp\src\lib\a.js
Not found: D:\dev\repro-ts-node-esm-yarn-pnp\src\lib\a.js
at makeError (D:\dev\repro-ts-node-esm-yarn-pnp\.pnp.cjs:5630:34)
at resolveUnqualified (D:\dev\repro-ts-node-esm-yarn-pnp\.pnp.cjs:7362:13)
at resolveRequest (D:\dev\repro-ts-node-esm-yarn-pnp\.pnp.cjs:7402:14)
at Object.resolveRequest (D:\dev\repro-ts-node-esm-yarn-pnp\.pnp.cjs:7458:26)
at resolve$1 (file:///D:/dev/repro-ts-node-esm-yarn-pnp/.pnp.loader.mjs:2043:21)
at nextResolve (node:internal/modules/esm/hooks:748:28)
at Hooks.resolve (node:internal/modules/esm/hooks:240:30)
at MessagePort.handleMessage (node:internal/modules/esm/worker:199:24)
at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:816:20)
at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)
Node.js v22.9.0
Steps to reproduce the problem / Minimal reproduction
$ yarn run test-with-custom-resolver
(node:47096) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
resolve-js2ts: file:///D:/dev/repro-ts-node-esm-yarn-pnp/src/main.ts
resolve-js2ts: ./lib/a.js
a
References
TypeStrong/ts-node#1361 - most relevant piece of information I have found. Judging by the fact that the issue is closed and the relevant pull requests have been merged, it would seem that the problem has been fixed in ts-node >1 year ago, except it apparently wasn't. Or maybe I'm dumb and there is another trap somewhere (as it usually is when it comes to Node.js, Yarn PNP, TypeScript and ESM).
Self-service
Describe the bug
Just reported this to ts-node (TypeStrong/ts-node#2148), but thought that the problem might lie on the Yarn PNP's side and you guys could take a look. Following is a copy of that bug report:
Search Terms
ts-node, esm, ts-node-esm, yarn-pnp
Expected Behavior
Given:
I shouldn't have problems running this TypeScript code with ts-node:
Command (actually a package.json script) being used:
Actual Behavior
Steps to reproduce the problem / Minimal reproduction
Repro project: https://github.com/earshinov/repro-ts-node-esm-yarn-pnp/
The error is seen in the GitHub actions workflow: https://github.com/earshinov/repro-ts-node-esm-yarn-pnp/actions/
Specifications
tsconfig.json:
package.json:
Workaround
Using a dump custom resolver. Command:
Custom resolver:
Output:
References
TypeStrong/ts-node#1361 - most relevant piece of information I have found. Judging by the fact that the issue is closed and the relevant pull requests have been merged, it would seem that the problem has been fixed in ts-node >1 year ago, except it apparently wasn't. Or maybe I'm dumb and there is another trap somewhere (as it usually is when it comes to Node.js, Yarn PNP, TypeScript and ESM).
To reproduce
Repro project: https://github.com/earshinov/repro-ts-node-esm-yarn-pnp/
The error is seen in the GitHub actions workflow: https://github.com/earshinov/repro-ts-node-esm-yarn-pnp/actions/
Environment
Additional context
No response
The text was updated successfully, but these errors were encountered: