Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

tsconfig-paths

Module resolution utility that loads Node.js modules according to TypeScript path mappings.

Languages, types and runtimesNPM

GitHubWebsite

1. License

License from npm.

github.com/dividab/tsconfig-paths

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What tsconfig-paths does

tsconfig-paths makes plain Node and ts-node honor the <code>paths</code> aliases in <code>tsconfig.json</code> at run time. You preload <code>tsconfig-paths/register</code>, and it patches Node's module loading so aliased imports resolve to real files.

tsconfig-paths popularity

66 / 100
Gid Score, #641 overall
165M
downloads a week, npm
1,906
GitHub stars
41
agent projects use it
tsconfig-paths: downloads per weeknpm, tsconfig-paths 164,542,739
tsconfig-paths: GitHub starsdividab/tsconfig-paths 1,906

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How tsconfig-paths is used

  • tsconfig-paths is a dependency in 41 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (0.8% of the 4,867 JavaScript/TypeScript ones), #8 of 70 in languages, types and runtimes.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 159; those are left out of every share on this page.
  • The most used alternative in our scan is ts-node (295 projects).
  • Projects that use it most often also use ts-node (75.6%), Jest (63.4%), dotenv (56.1%).

By coding agent

26 projects, 0.8%
23 projects, 0.9%
22 projects, 0.7%

Often used with

In 75.6% of its projects
In 63.4% of its projects
In 56.1% of its projects
In 63.4% of its projects
In 46.3% of its projects
In 97.6% of its projects
In 43.9% of its projects
In 41.5% of its projects

tsconfig-paths in practice

Strengths

One flag, no code changes

Add <code>-r tsconfig-paths/register</code> to node or ts-node. It reads <code>paths</code> from <code>tsconfig.json</code> or <code>jsconfig.json</code> and maps aliased requires to files Node can load.

Works with any preloading command

The README covers node, ts-node, mocha and a VSCode <code>launch.json</code> setup. It says any command with a <code>--require</code>-like option should work.

Bootstrap for compiled output

You can call <code>register</code> yourself with an explicit <code>baseUrl</code> and <code>paths</code>. The README suggests this when <code>tsc</code> wrote output to a directory with no <code>tsconfig.json</code>.

Matching API for tool authors

<code>createMatchPath</code> takes <code>baseUrl</code> and <code>paths</code> as written in tsconfig and returns a resolver function. Async variants exist, and <code>matchFromAbsolutePaths</code> is a lower-level version for pre-resolved mappings.

Watch out for

It patches Node's module loader

<code>register</code> changes Node's module loading for the whole process. It returns a function that restores the original loader, which you call when registration is no longer needed.

Config is found from the working directory

If no explicit params or <code>TS_NODE_PROJECT</code> are given, the README says <code>tsconfig.json</code> is resolved from the current working directory. Starting the process from another folder can change which config is used.

Not for Webpack

Webpack builds are handled by a separate package. The README points to tsconfig-paths-webpack-plugin.

Register paths explicitly for compiled output

const tsConfig = require("./tsconfig.json");
const tsConfigPaths = require("tsconfig-paths");

const baseUrl = "./"; // Either absolute or relative path. If relative it's resolved to current working directory.
const cleanup = tsConfigPaths.register({
  baseUrl,
  paths: tsConfig.compilerOptions.paths,
});

// When path registration is no longer needed
cleanup();

More about tsconfig-paths

Packages around it
  • ts-node: TypeScript execution for Node
  • prettier: Code formatter
  • dotenv: Env vars from .env files
  • jest: Test runner
  • axios: HTTP client
  • typescript: TypeScript compiler
More in Languages, types and runtimes

Alternatives

tsconfig-paths This page

MITGid 66165M/wk

ts-node

TypeScript execution environment for Node.js with source map support.

MITGid 8162.2M/wk

jiti

Runtime TypeScript and ESM support for Node.js without build steps.

MITGid 67269M/wk

Compare tsconfig-paths with another tool

Get started

Install it.

npm install tsconfig-paths

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## tsconfig-paths
- Install as a dev dependency: `npm install --save-dev tsconfig-paths`.
- Run with `node -r tsconfig-paths/register main.js` or `ts-node -r tsconfig-paths/register main.ts`.
- For mocha, use `mocha -r ts-node/register -r tsconfig-paths/register "test/**/*.ts"`. Use `-r`, not `--compiler`, and include a `.ts` glob.
- If the tsconfig is not in the working directory, set `TS_NODE_PROJECT` or pass `--project`. Use `TS_NODE_BASEURL=./dist` to point `baseUrl` at compiled output.
- When running `tsc` output from a directory without `tsconfig.json`, write a bootstrap script that calls `register({ baseUrl, paths })` and preload it with `node -r`.
- Call the cleanup function returned by `register` when path registration is no longer needed.
- Do not use this package for Webpack builds. Use tsconfig-paths-webpack-plugin instead.