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

144
Views
Tsconfig `paths` equivalent for normal JS node

I have this on a TypeScript project, it's a nice config option on tsconfig.json that lets me create aliases for the folders

{
"compilerOptions": {
  "paths": {
    "@src/*": ["src/*"],
    "@images/*": ["src/assets/images/*"],
    "@styles/*": ["src/assets/styles/*"],
    "@components": ["src/components"],
    "@layout/*": ["src/layout/*"],
    "@pages/*": ["src/pages/*"]
  }
}

Is there a way to do the same on a project that does not use TypeScript, just regular Javascript in node with ES6 modules on?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I found that node already has something called Subpath imports, is not exactly the same but it works for me. For anyone looking for something similar, this just uses # instead of @:

on the package.json

"imports": {
  "#src": "./src/*",
  "#controllers/*": ["./src/controllers/*"],
  "#routes/*": ["./src/routes/*"]
}

And then import on your app, – In this case I use ES modules:

import File from '#routes/file.js'
about 4 years ago · Juan Pablo Isaza Report
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!