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

252
Vistas
Require JS Module in Node JS without using DOTS in my file path

I'm using a lot of files of .JS in my project that are spread in multiple folders and whenever I need to require on of them , I'm ending up with some ugly require that looks like

const Employee = require('../../../abstracts/classes/Employee');

Or if I'm using another require that's located in the different folder in the path tree , it can be as follows:

const Client = require('../../abstracts/classes/Client');

Is there a way to save all the .. (dots) headache and use the father folder as a starting point?

Let's assume that my tree is as follows:

FatherFolder 
-main.js 
-abstracts/classes // here we have "Client.js" & "Employee.js"
-folder1/folder2/folder3/file1.js
-folder1/folder2/file2.js

And I want to require Employee.js and Client.js in file1 and file2 without using dots.

Thanks

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