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