jutsu-bun:bun-bundler

Bundle JavaScript/TypeScript applications for Bun, browser, and Node.js targets.

187|20|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/TheBushidoCollective/han --skill jutsu-bun-bun-bundler
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jutsu-bun:bun-bundler
Source: https://github.com/TheBushidoCollective/han/tree/main/jutsu/jutsu-bun/skills/bun-bundler
Command: npx skills add https://github.com/TheBushidoCollective/han --skill jutsu-bun-bun-bundler

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill explains bundling with Bun's built-in bundler, including targets, splitting, and optimization strategies.

Core Features & Use Cases

  • Build Targets: Bundle for bun runtime, browser, or node.
  • Code Splitting & Tree Shaking: Optimize bundle size and load performance.
  • Output Configuration: Control formats, define env vars, and external dependencies.

Quick Start

Bundle a simple app for the browser and enable code splitting for performance.

Frequently Asked Questions about jutsu-bun:bun-bundler

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I bundle JavaScript and TypeScript applications with Bun?

Bun's bundler compiles JS/TS apps into optimized outputs using its build API. Configure entrypoints, output directory, target (bun, browser, or node), format, and minification settings to produce bundles tailored to your runtime environment.

What's the best way to reduce bundle size with tree shaking and code splitting?

Tree shaking removes unused code during bundling; code splitting separates bundles by entry point for faster load times. Bun's bundler enables both through the splitting option and automatic dead-code elimination, optimizing performance across targets.

Can I bundle for multiple targets like browsers and Node.js with the same source?

Yes, Bun's bundler supports multi-target builds through the target option. Define separate entrypoints and output directories for browser, bun, or node targets, applying target-specific optimizations and external dependency handling to each.

How do I handle environment variables and external dependencies in my bundle?

Use Bun's define option to inline environment variables at build time and the external option to exclude dependencies from the bundle. This keeps bundles lean while ensuring runtime access to shared libraries and configuration.

Does Bun's bundler support sourcemaps for debugging minified code?

Yes, enable sourcemap generation with the sourcemap option to map minified code back to original sources. This simplifies debugging production bundles while maintaining the performance gains from minification.

What output formats does Bun support for bundled applications?

Bun's bundler produces formats suited to each target: ESM for modern browsers, CommonJS for Node.js, and bun-compatible output for Bun runtime. Configure format and publicPath settings to control module syntax and asset loading behavior.