diff options
| author | 2023-05-16 10:47:00 -0700 | |
|---|---|---|
| committer | 2023-05-16 10:47:00 -0700 | |
| commit | 366eba78f0b9b2c58cdd46b906275fc8382da977 (patch) | |
| tree | 8966c3964aeacc4a7f61a69164467e9ebf37b6e1 /docs/bundler/executables.md | |
| parent | 60bc804c58b18e99763b2d05e81bafa46800092f (diff) | |
| download | bun-366eba78f0b9b2c58cdd46b906275fc8382da977.tar.gz bun-366eba78f0b9b2c58cdd46b906275fc8382da977.tar.zst bun-366eba78f0b9b2c58cdd46b906275fc8382da977.zip | |
Tweaks to bundler docs (#2867)
* WIP
* Fix typo
* Updates
* Document --compile
* Add bundler benchmark
* Remove esbuild
* Add bench to docs
* Add buttons
* Updates
Diffstat (limited to 'docs/bundler/executables.md')
| -rw-r--r-- | docs/bundler/executables.md | 33 |
1 files changed, 33 insertions, 0 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 %} |
