0

In my express.js typescript project, I've added custom paths to my express tsconfig.json file like this:

enter image description here

Then I'm importing my files with absolute custom path with no error like this:

enter image description here

But after building the project with tsc command, the import string in my built .js file is the exact same string as .ts file and my import path mapping is not working.

enter image description here

enter image description here

Shervin Rafiee
  • 373
  • 2
  • 3
  • 11

1 Answers1

0

Problem solved using both tsc-alias and tsconfig-paths packages.

"build": "npx tsc && tsc-alias -p tsconfig.json"

"dev": "nodemon -r tsconfig-paths/register index.ts"

more info: Typescript paths not working in an Express project

Shervin Rafiee
  • 373
  • 2
  • 3
  • 11