aboutsummaryrefslogtreecommitdiff
path: root/docs/runtime/loaders.md
diff options
context:
space:
mode:
authorGravatar Colin McDonnell <colinmcd94@gmail.com> 2023-02-23 17:13:30 -0800
committerGravatar GitHub <noreply@github.com> 2023-02-23 17:13:30 -0800
commitf54300578b1edc7f67daddbfae29575cbf305264 (patch)
tree1437f3274122c011f879dca71f59a74d75a33fd0 /docs/runtime/loaders.md
parent5929daeeae1f528abab31979a0a28bc87a03b1f4 (diff)
downloadbun-f54300578b1edc7f67daddbfae29575cbf305264.tar.gz
bun-f54300578b1edc7f67daddbfae29575cbf305264.tar.zst
bun-f54300578b1edc7f67daddbfae29575cbf305264.zip
Add documentation (#2148)bun-v0.5.7
* Add documentation * Tweaks * Fixes * Rearrange * Update
Diffstat (limited to '')
-rw-r--r--docs/runtime/loaders.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/docs/runtime/loaders.md b/docs/runtime/loaders.md
new file mode 100644
index 000000000..c7977534c
--- /dev/null
+++ b/docs/runtime/loaders.md
@@ -0,0 +1,28 @@
+A loader determines how to map imports &amp; file extensions to transforms and output.
+
+Currently, Bun implements the following loaders:
+
+| Input | Loader | Output |
+| ----- | ----------------------------- | ------ |
+| .js | JSX + JavaScript | .js |
+| .jsx | JSX + JavaScript | .js |
+| .ts | TypeScript + JavaScript | .js |
+| .tsx | TypeScript + JSX + JavaScript | .js |
+| .mjs | JavaScript | .js |
+| .cjs | JavaScript | .js |
+| .mts | TypeScript | .js |
+| .cts | TypeScript | .js |
+| .toml | TOML | .js |
+| .css | CSS | .css |
+| .env | Env | N/A |
+| .\* | file | string |
+
+Everything else is treated as `file`. `file` replaces the import with a URL (or a path).
+
+You can configure which loaders map to which extensions by passing `--loaders` to `bun`. For example:
+
+```sh
+$ bun --loader=.js:js
+```
+
+This will disable JSX transforms for `.js` files.