tsconfig.json 文件中的 paths 字段以重新写入导入路径。这对于别名包名或避免冗长的相对路径非常有用。
tsconfig.json
根据上述
tsconfig.json,以下导入语句将被重写:
有关在 Bun 中使用 TypeScript 的更多信息,请参见文档 > 运行时 > TypeScript。
tsconfig.json 文件中的 paths 字段以重新写入导入路径。这对于别名包名或避免冗长的相对路径非常有用。
{
"compilerOptions": {
"paths": {
"my-custom-name": ["zod"],
"@components/*": ["./src/components/*"]
}
}
}
tsconfig.json,以下导入语句将被重写:
import { z } from "my-custom-name"; // 从 "zod" 导入
import { Button } from "@components/Button"; // 从 "./src/components/Button" 导入