Typorithm · medium

bun build & bunx

bun-build-xbunbundlerbunxscaffold
Saved on this device
Full lesson · 8 learning steps Open any exercise for focused practice
1

Step 1 of 8 · intro card

Learn bun build & bunx

0%

bun CLI

bun build bundles an entry into --outdir for a --target; bunx runs a CLI once without installing (like npx); bun create scaffolds a project from a template.

bun build is Bun's bundler: point it at an entry file, choose an --outdir, and pick a --target like browser, bun, or node.

bunx runs a package's CLI on demand without adding it to your project, the way npx does, but faster.

bun create <template> bootstraps a fresh project from a known template, e.g. bun create next-app.

01

bun build bundles an entry to --outdir for a --target.

02

bunx runs a CLI once without installing it.

03

bun create scaffolds a project from a template.

bun build ./index.ts --outdir ./dist --target browser
bunx prettier --write .
bun create next-app

Read the implementation

Connect each part of the code to the concept before you type.

1. Bundle entry

bun build bundles an entry file and its imports into output files.

bun build ./index.ts

2. Output dir

--outdir sets the directory where bundled output is written.

--outdir ./dist

3. Build target

--target browser tunes the bundle for the browser; other targets include bun and node.

--target browser

4. One-off tool

bunx runs a CLI from a package without installing it, like npx.

bunx prettier --write .

5. Scaffold

bun create scaffolds a new project from a template, like create-next-app.

bun create next-app

A complete learning loop

01

Understand

Read the concept map and follow the code breakdown.

02

Reconstruct

Type the implementation, repair mistakes and work through every recall exercise.

03

Verify

Use the final check without hints; revisit weak concepts in short practice sessions.

bun build & bunx: Lesson & Practice · Typorithm | ApplyDjinn