aboutsummaryrefslogtreecommitdiff
path: root/docs/guides/runtime/tsconfig-paths.md
blob: 5c3f591f594a84828c35480f12421ffd18240208 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
---
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.

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

---

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

```ts
import { z } from "my-custom-name"; // imports from "zod"
import { Button } from "@components/Button"; // imports from "./src/components/Button"
```

---

See [Docs > Runtime > TypeScript](/docs/runtime/typescript) for more information on using TypeScript with Bun.