aboutsummaryrefslogtreecommitdiff
path: root/docs/guides/runtime/tsconfig-paths.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/guides/runtime/tsconfig-paths.md')
-rw-r--r--docs/guides/runtime/tsconfig-paths.md29
1 files changed, 29 insertions, 0 deletions
diff --git a/docs/guides/runtime/tsconfig-paths.md b/docs/guides/runtime/tsconfig-paths.md
new file mode 100644
index 000000000..5c3f591f5
--- /dev/null
+++ b/docs/guides/runtime/tsconfig-paths.md
@@ -0,0 +1,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.