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

308
Views
TypeScript relative path does not resolve to index file

I'm working on a project and I set up absolute path imports in my project. But, it doesn't resolve to the index file if I put only up to the folder name.

src
 |--modules
      |--search
           |--utils.ts
           |--index.ts

When I import, import { something } from 'modules/search/index' it works fine.

But, I when I import like import { something } from 'modules/search' It says, src/modules/search.ts not found.

Following is my tsconfig.json.

{
  "compileOnSave": false,
  "compilerOptions": {
    "rootDir": ".",
    "strict": true,
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "module": "esnext",
    "lib": ["es2017", "dom"],
    "skipLibCheck": true,
    "skipDefaultLibCheck": true,
    "baseUrl": "src",
  },
  "exclude": ["node_modules", "tmp"]
}

How can I solve this problem?

The expected behavior is, import { something } from 'modules/search' should resolve to src/modules/search/index.ts

import { something } from 'modules/search/utils' should resolve to src/modules/search/utils.ts

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!