TypeStrong / ts-node

TypeScript execution and REPL for node.js

Home Page:https://typestrong.org/ts-node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ESM + path mapping

damianobarbati opened this issue · 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';
commented

same as

commented

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