npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tsconfig-aliases

v1.1.2

Published

Parse aliases from tsconfig.json for bundler configurations.

Downloads

29

Readme

TSConfig Aliases

en(English) | zh(中文)

Parse aliases from tsconfig.json (or other tsconfig files) for bundler configurations.

This package is designed to work with bundlers like Rolldown. It is exactly a tool for parsing aliases in Record<string, string> format from a tsconfig.json file or parsed object, you can use it in any bundler that support configuration format like this.

Usages

1. Parse Aliases from tsconfig.json

You may configure tsconfig.json like this:

{
  // Definitely, this package supports parse from json with comments.
  "compilerOptions": {
    // ... (other compiler options)
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"],
    },
  },
  "include": [
    // ... (custom include paths)
  ],
}

And then you can use it in your bundler like this:

// Rolldown for example.
import { builtinModules } from "node:module"
import { defineConfig } from "rolldown"
import { dts } from "rolldown-plugin-dts"
import tsconfigAliases from "tsconfig-aliases"

export default defineConfig({
  // Configure like this and it will detect tsconfig.json in cwd by default.
  resolve: { alias: tsconfigAliases() },

  // Other options for example.
  plugins: [dts({ sourcemap: true })],
  external: [/^node:/g, ...builtinModules],
  input: "xxx.ts",
  output: { dir: "xxx", format: "esm", minify: true, sourcemap: true },
})

2. Custom TSConfig Path

You can also specify a custom path to tsconfig.json like this:

// Rolldown for example.
import { builtinModules } from "node:module"
import { defineConfig } from "rolldown"
import { dts } from "rolldown-plugin-dts"
import tsconfigAliases from "tsconfig-aliases"

export default defineConfig({
  // Specify custom tsconfig.json path.
  resolve: { alias: tsconfigAliases("./tsconfig.build.json") },

  // Other options for example.
  plugins: [dts({ sourcemap: true })],
  external: [/^node:/g, ...builtinModules],
  input: "xxx.ts",
  output: { dir: "xxx", format: "esm", minify: true, sourcemap: true },
})

3. Custom TSConfig Object

// Rolldown for example.
import { readFileSync } from "node:fs"
import { builtinModules } from "node:module"
import { defineConfig } from "rolldown"
import { dts } from "rolldown-plugin-dts"
import tsconfigAliases from "tsconfig-aliases"

const tsconfig = readFileSync("./tsconfig.xxx.json", "utf-8")

export default defineConfig({
  // Specify custom tsconfig.json object.
  resolve: { alias: tsconfigAliases(tsconfig) },

  // Other options for example.
  plugins: [dts({ sourcemap: true })],
  external: [/^node:/g, ...builtinModules],
  input: "xxx.ts",
  output: { dir: "xxx", format: "esm", minify: true, sourcemap: true },
})

Compatibilities

When using commonjs mode, you need to use default to access the default exported function like this:

const tsconfigAliases = require("tsconfig-aliases").default

or:

const { default: tsconfigAliases } = require("tsconfig-aliases")

Open Source License

This package is released under the Apache 2.0 License.