Files
bun.sh/docs/guides/runtime/tsconfig-paths.md
Colin McDonnell 404b90badc Add ecosystem guides (#3847)
* Add ecosystem guides

* Update titles

* Rename stric

* Add unlink and fetch guides

* Add formdata guide

* Tweak title

* Moar
2023-07-31 12:20:23 -07:00

681 B

name
name
Re-map import paths

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.

{
  "compilerOptions": {
    "paths": {
      "my-custom-name": "zod",
      "@components/*": "./src/components/*"
    }
  }
}

With the above tsconfig.json, the following imports will be re-written:

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.