TypeStrong / ts-node

TypeScript execution and REPL for node.js
https://typestrong.org/ts-node
MIT License
12.75k stars 529 forks source link

ESM + path mapping #2068

Open damianobarbati opened 10 months ago

damianobarbati commented 10 months ago

Is https://typestrong.org/ts-node/docs/paths/ supposed to be working with ESM?

Adding the following to tsconfig.json:

  "ts-node": {
    "esm": true,
    "experimentalSpecifierResolution": "node",
    "require": ["tsconfig-paths/register"]
  }

Results in this error:

Error: Cannot find package '@controller/Lesson' imported from /Users/damians/Desktop/box696/packages/api/src/jobs.ts

When trying to load any mapped import:

import LessonController from '@controller/Lesson';
soom-lupulus commented 10 months ago

same as

Naddiseo commented 9 months ago

Here's my workaround for the issue and the thread has other suggestions too

sleep-written commented 8 months ago

Check this response.