ts-node
ts-node copied to clipboard
Cannot run mts and ts files with ESM syntax
Search Terms
- https://github.com/TypeStrong/ts-node/issues/935
Expected Behavior
print '???' in terminal
Actual Behavior
Steps to reproduce the problem
-
pnpm i
-
pnpm start
Minimal reproduction
https://github.com/wbxl2000/ts-esm-test
Specifications
- ts-node version: v10.9.1
- node version: v20.2.0
- TypeScript version: v5.1.6
- tsconfig.json, if you're using one:
{
"compilerOptions": {
"module": "ESNext" // or ES2015, ES2020
},
"ts-node": {
// Tell ts-node CLI to install the --loader automatically, explained below
"esm": true
}
}
- package.json:
{
"name": "ts-node-test",
"version": "1.0.0",
"description": "",
"type": "module",
"scripts": {
"start": "ts-node ./test.ts"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
}
}
- Operating system and version: macOS 13.5 (22G74)
- If Windows, are you using WSL or WSL2?:
Minimal reproduction
same to above
Specifications
- ts-node version:
- node version:
- TypeScript version:
- tsconfig.json, if you're using one:
{}
- package.json:
{}
- Operating systion:
- If Windows, are you using WSL or WSL2?:
After switching to nodejs 16, I was able to execute it normally. But why is that?
Seems to be duplicated with #1997