Add some missing docs

This commit is contained in:
Jarred Sumner
2025-10-09 23:28:03 -07:00
parent 3395774c8c
commit 98d1a9d110
8 changed files with 123 additions and 6 deletions

View File

@@ -586,12 +586,41 @@ Codesign support requires Bun v1.2.4 or newer.
{% /callout %}
## Code splitting
Standalone executables support code splitting. Use `--compile` with `--splitting` to create an executable that loads code-split chunks at runtime.
```bash
$ bun build --compile --splitting ./src/entry.ts --outdir ./build
```
{% codetabs %}
```ts#src/entry.ts
console.log("Entrypoint loaded");
const lazy = await import("./lazy.ts");
lazy.hello();
```
```ts#src/lazy.ts
export function hello() {
console.log("Lazy module loaded");
}
```
{% /codetabs %}
```bash
$ ./build/entry
Entrypoint loaded
Lazy module loaded
```
## Unsupported CLI arguments
Currently, the `--compile` flag can only accept a single entrypoint at a time and does not support the following flags:
- `--outdir` — use `outfile` instead.
- `--splitting`
- `--outdir` — use `outfile` instead (except when using with `--splitting`).
- `--public-path`
- `--target=node` or `--target=browser`
- `--no-bundle` - we always bundle everything into the executable.