path-alias is a drop in replacement for module-alias.
In addition to module-alias features, you're able to resolve a path from a string, ex: for fs or path operations.
Like module-alias, you can make aliases for directories and files, and define custom module paths.
This package isn't guaranteed to work nicely, and depends on github repos I have, instead of npm.
npm install https://github.com/int3nse-git/path-aliasSee module-alias for most of the usage.
The differences are as follows:
_pathAliasesis a new name for_moduleAliasesin your package.json, but both workpath-alias/registerreturns the module too nowaddAliascan accept an object of aliases, simmilar to package.jsonpathContainsAliasis a new name forisPathMatchesAlias, but both workaddAliasis a new name foraddAliases, but both work
const pathAlias = require('path-alias/register');
const myModule = require('$modules/myModule.js');
console.log(pathAlias.resolve('$root/foo/bar.js')); // -> yourProjectDirectory/foo/bar.jsconst pathAlias = require('path-alias');
console.log(pathAlias.resolve('$root/foo/bar.js')); // -> yourProjectDirectory/foo/bar.js