xxxxxxxxxx
// Step 1: Install
npm i --save module-alias
// Step 2: Create the aliases in "package.json"
"_moduleAliases": {
"@root" : ".", // Application's root
"@deep" : "src/some/very/deep/directory/or/file",
"@my_module" : "lib/some-file.js",
"something" : "src/foo", // Or without @. Actually, it could be any string
}
// Step 3: Then add this line at the very top of the main file of your app...
// ... before any code.
require('module-alias/register')