Skip to content

Bun 은 tsconfig.jsonpaths 필드를 읽어서 import 경로를 재작성합니다. 이는 패키지 이름을 별칭으로 지정하거나 긴 상대 경로를 피하는 데 유용합니다.

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

위의 tsconfig.json 을 사용하면 다음 import 가 재작성됩니다.

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

Bun 과 함께 TypeScript 사용에 대한 자세한 내용은 문서 > 런타임 > TypeScript 를 참조하세요.

Bun by www.bunjs.com.cn 편집