-
-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yarn pnp not working with ts-node and ESmodule #1709
Comments
This is probably a yarn limitation; I recommend checking with them. |
Yarn pnp works fine with ts-node, but not when the project is setup as a ESmodule. This is the key distinction here. I can change the package to |
Yes, that implies to me that this is a limitation of node and yarn with ESmodules. Keep in mind, node's support for certain esmodule features is experimental and incomplete: |
Appears to be an issue directly with node and its loaders |
you can use |
For future visitors to this issue, I fixed this by updating my yarn version from 3.2.3 to 3.4.1 (current latest) |
@shixinhuang99 Works just fine, even with |
Thanks for the advice but I've moved on to pnpm |
Search Terms
ts-node pnp
Expected Behavior
Able to run ts-node with yarn pnp for a simple typescript file.
Actual Behavior
Breaking on initiation of the esm_loader => ts-node/child-loader
yarn ts-node ./src/index.ts
Steps to reproduce the problem
yarn init -2
yarn install -D typescript ts-node tslib @types/node
package.json
- updated to have"type": "module"
- for ESmodule setuptouch tsconfig.json
-- see belowmkdir src
touch src/index.ts
-- see belowyarn ts-node src/index.ts
Minimal reproduction
Repo prepared here:
https://github.com/Darkbladecr/ts-node-pnp
package.json
tsconfig.json
src/index.ts
Specifications
ts-node version: "^10.7.0"
node version: "v16.14.2"
TypeScript version: have tried ~4.3, ~4.4, ~4.5, ~4.6
tsconfig.json, if you're using one (see above)
Operating system and version: OSX 12.3
The text was updated successfully, but these errors were encountered: