Skip to content
Agentmart
Submit a tool

bun-build

Create optimized production bundles with Bun's native bundler.

Skill by dale

IndexedMIT★ 1
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/involvex-bun-build-0a9a6f

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Create optimized production bundles with Bun's native bundler. Use when building applications for production, optimizing bundle sizes, setting up multi-environment builds, or replacing webpack/esbuild/rollup.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/bun-build

What's inside

Skill name
bun-build
Description
Create optimized production bundles with Bun's native bundler. Use when building applications for production, optimizing bundle sizes, setting up multi-environment builds, or replacing webpack/esbuild/rollup.
License
MIT
Compatibility
Requires Bun 1.0+
Metadata
author: dale · category: bun-runtime
Instructions
383 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • allowed-tools: must be a space-separated string

Files (4)

  • SKILL.md
  • optimization.md · references/
  • plugins.md · references/
  • targets.md · references/

SKILL.md (first lines)

---
name: bun-build
description: Create optimized production bundles with Bun's native bundler. Use when building applications for production, optimizing bundle sizes, setting up multi-environment builds, or replacing webpack/esbuild/rollup.
compatibility: Requires Bun 1.0+
allowed-tools: ["Bash", "Write", "Read"]
metadata:
  author: dale
  category: bun-runtime
  tags: [bun, build, bundler, production, optimization]
---

# Bun Production Build Configuration

Set up production builds using Bun's native bundler - fast, optimized bundle creation without webpack or esbuild.

## Quick Reference

For detailed patterns, see:
- **Build Targets**: [targets.md](references/targets.md) - Browser, Node.js, library, CLI configurations
- **Optimization**: [optimization.md](references/optimization.md) - Tree shaking, code splitting, analysis
- **Plugins**: [plugins.md](references/plugins.md) - Custom loaders and transformations

## Core Workflow

### 1. Check Prerequisites

```bash
# Verify Bun installation
bun --version

# Check project structure
ls -la package.json src/
```

### 2. Determine Build Requirements

Ask the user about their build needs:

- **Application Type**: Frontend SPA, Node.js backend, CLI tool, or library
- **Target Platform**: Browser, Node.js, Bun runtime, or Cloudflare Workers
- **Output Format**: ESM (modern), CommonJS (legacy), or both

### 3. Create Basic Build Script

Create `build.ts` in project root:

```typescript
#!/usr/bin/env bun

const result = await Bun.build({
  entrypoints: ['./src/index.ts'],
  outdir: './dist',
  target: 'browser', // or 'node', 'bun'
  format: 'esm', // or 'cjs', 'iife'
  minify: true,
  splitting: true,
  sourcemap: 'external',
});

if (!result.success) {
  console.error('Build failed');
  for (const message of result.logs) {
    console.error(message);
  }
  process.exit(1);
}

console.log('✅ Build successful');
console.log(`📦 ${result.outputs.length} files generated`);

// Show bundle sizes
for (const output of result.outputs) {
  const size = (output.size / 1024).toFixed(2);
  console.log(`  ${output.path} - ${size} KB`);
}
```

### 4. Configure for Target Platform

**For Browser/Frontend:**

```typescript
await Bun.build({
  entrypoints: ['./src/index.tsx'],
  outdir: './dist',
  target: 'browser',
  format: 'esm',
  minify: true,
  splitting: true,
  define: {
    'process.env.NODE_ENV': '"production"',
  },
  loader: {
    '.png': 'file',
    '.svg': 'dataurl',
    '.css': 'css',
  },
});
```

**For Node.js Backend:**

```typescript
await Bun.build({
  entrypoints: ['./src/server.ts'],
  outdir: './dist',
  target: 'node',
  format: 'esm',
  minify: true,
  external: ['*'], // Don't bundle node_modules
});
```

**For libraries, CLI tools, and other targets**, see [targets.md](references/targets.md).

### 5. Add Production Optimizations

```typescript
await Bun.build({
  entrypoints: ['./src/index.ts'],

From involvex/syncstuff, MIT.

More from involvex/syncstuff

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Apr 22, 2026 (6 months ago)
Last release
Jan 7, 2026 (9 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

Same skill elsewhere

Copies of this SKILL.md published by others; search shows only one of them.

More from dale

Cite this page

bun-build skill. Agent Mart. https://agentmart.dev/skills/involvex-bun-build-0a9a6f (last updated 2026-10-24)