TypeStrong/ts-node

ESM + path mapping

damianobarbati opened this issue · 3 comments

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';

same as

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