Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

173
Views
Cannot find module's path alias defined in tsconfig

My application's structure is as follows:

myApplication
├── app
│   ├── api
│   ├── services
│   └── db
│       ├── index.ts
│       └── config.ts
│
├── test
│   └── helpers
│       └── setupTests.ts
│
└── tsconfig.json

and I've defined the following path aliases inside tsconfig.json:

{
  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "@/*": ["*"],
      "@Api/*": ["app/api/*"],
      "@Services/*": ["app/services/*"],
      "@Db/*": ["app/db/*"],
    },
    "outDir": "dist",
    "sourceMap": true,
    "plugins": [
      { "transform": "typescript-transform-paths" }
    ]
  }
}

using any of the path aliases in a file inside app/ works fine but when running the app with the following import inside test/helpers/setupTests.ts:

import config from '@Db/config';

I get the following error: Error: Cannot find module '@Db/config'. How can this be fixed?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!