Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

178
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda