aboutsummaryrefslogtreecommitdiff
path: root/docs/bundler
diff options
context:
space:
mode:
Diffstat (limited to 'docs/bundler')
-rw-r--r--docs/bundler/executables.md33
-rw-r--r--docs/bundler/migration.md2
2 files changed, 34 insertions, 1 deletions
diff --git a/docs/bundler/executables.md b/docs/bundler/executables.md
new file mode 100644
index 000000000..9a0fc639e
--- /dev/null
+++ b/docs/bundler/executables.md
@@ -0,0 +1,33 @@
+Bun's bundler implements a `--compile` flag for generating a standalone binary from a TypeScript or JavaScript file.
+
+{% codetabs %}
+
+```bash
+$ bun build ./cli.ts --compile --outfile mycli
+```
+
+```ts#cli.ts
+console.log("Hello world!");
+```
+
+{% /codetabs %}
+
+This bundles `cli.ts` into an executable that can be executed directly:
+
+```
+$ ./mycli
+Hello world!
+```
+
+All imported files and packages are bundled into the executable, along with a copy of the Bun runtime. All built-in Bun and Node.js APIs are supported.
+
+{% callout %}
+
+**Note** — Currently, the `--compile` flag can only accept a single entrypoint at a time and does not support the following flags:
+
+- `--outdir` — use `outfile` instead.
+- `--external`
+- `--splitting`
+- `--publicPath`
+
+{% /callout %}
diff --git a/docs/bundler/migration.md b/docs/bundler/migration.md
index e76d50103..1bf9d52dc 100644
--- a/docs/bundler/migration.md
+++ b/docs/bundler/migration.md
@@ -6,7 +6,7 @@ Bun's bundler API is inspired heavily by [esbuild](https://esbuild.github.io/).
There are a few behavioral differences to note.
-- **Bundling by default**. Unlike esbuild, Bun _always bundles by default_. This is why the `--bundle` flag isn't necessary in the Bun example. To transpile each file individually, use [`Bun.Transpiler`](/docs/api/transpiler.md).
+- **Bundling by default**. Unlike esbuild, Bun _always bundles by default_. This is why the `--bundle` flag isn't necessary in the Bun example. To transpile each file individually, use [`Bun.Transpiler`](/docs/api/transpiler).
- **It's just a bundler**. Unlike esbuild, Bun's bundler does not include a built-in development server or file watcher. It's just a bundler. The bundler is intended for use in conjunction with `Bun.serve` and other runtime APIs to achieve the same effect. As such, all options relating to HTTP/file watching are not applicable.
## Performance