Skip to content
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

Cannot run mts and ts files with ESM syntax #2047

Open
wbxl2000 opened this issue Aug 16, 2023 · 2 comments
Open

Cannot run mts and ts files with ESM syntax #2047

wbxl2000 opened this issue Aug 16, 2023 · 2 comments

Comments

@wbxl2000
Copy link

Search Terms

Expected Behavior

print '???' in terminal

Actual Behavior

image

Steps to reproduce the problem

  1. pnpm i
  2. 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)
image
  • 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?:
@wbxl2000
Copy link
Author

After switching to nodejs 16, I was able to execute it normally. But why is that?

@jameslan
Copy link

Seems to be duplicated with #1997

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants