Skip to main content
Bun reads the paths field in your tsconfig.json to re-write import paths. This is useful for aliasing package names or avoiding long relative paths.
tsconfig.json
{
  "compilerOptions": {
    "paths": {
      "my-custom-name": ["zod"],
      "@components/*": ["./src/components/*"]
    }
  }
}

With the above tsconfig.json, the following imports will be re-written:
https://mintcdn.com/bun-1dd33a4e-claude-docs-bunfig-missing-fields/ezY9cqHIbAlx71jp/icons/typescript.svg?fit=max&auto=format&n=ezY9cqHIbAlx71jp&q=85&s=fa9c9d5f512d0d81ae41ed65741d389atsconfig.ts
import { z } from "my-custom-name"; // imports from "zod"
import { Button } from "@components/Button"; // imports from "./src/components/Button"

See Docs > Runtime > TypeScript for more information on using TypeScript with Bun.