DEV Community

mgv
mgv

Posted on

A fast, zero-dependency path alias resolver for Node.js

In large Node.js projects, relative imports can quickly get out of hand:

const logger = require("../../../../utils/logger");
Enter fullscreen mode Exit fullscreen mode

So I built pathlra-aliaser — a small, fast path alias resolver for Node.js.

It lets you write clean imports like:

const logger = require("@utils/logger");
Enter fullscreen mode Exit fullscreen mode

You define the alias once for a folder or a file
and then you can import it from anywhere in the project, as many times as you want,
without repeating long relative paths.

Aliases are resolved directly from package.json.

No Babel
No TypeScript
No build step

Just pure Node.js with zero dependencies.

It’s designed to stay fast even as projects grow, with built-in caching and predictable behavior.

github Repo:
https://github.com/hub-mgv/pathlra-aliaser

npm:
https://www.npmjs.com/package/pathlra-aliaser

Top comments (0)