Skip to content

Introduction

Bunup is the ⚡️ blazing-fast build tool for TypeScript libraries, designed for flawless developer experience and speed, powered by Bun.

Performance

Bunup delivers instant builds by design. With Bun's native speed, builds and rebuilds are extremely quick, even in monorepos. See benchmarks.

ToolBuild Time (s)Relative Speed
bunup0.37 sbaseline
tsdown0.41 s1.11× slower
rslib1.41 s3.81× slower
unbuild3.19 s8.62× slower
tsup3.37 s9.11× slower

Quick Start

Quickly scaffold a new modern TypeScript or React library with Bunup in just 10 seconds.

sh
bunx @bunup/cli@latest create

See the Scaffold with Bunup page for more details.

Or, initialize bunup in an existing project:

sh
bunx @bunup/cli@latest init

Prerequisites

Enable isolatedDeclarations in your tsconfig:

tsconfig.json
json
{
  "compilerOptions": {
    "declaration": true,
    "isolatedDeclarations": true
  }
}

See why here

Getting Started

Get started with Bunup in seconds - install, configure, and build your TypeScript projects with minimal setup.

Basic Usage

Create a TypeScript file:

src/index.ts
typescript
export function greet(name: string): string {
	return `Hello, ${name}!`;
}

Bundle it with bunup:

sh
bunx bunup src/index.ts

That's it! This creates bundled output in the dist directory with ESM format (the default), plus TypeScript declaration files (.d.ts) since the entry point is a TypeScript file.

Using with package.json

First, install bunup as a dev dependency:

sh
bun add --dev bunup

Add a build script to your package.json:

package.json
json
{
	"name": "my-package",
	"scripts": {
		"build": "bunup src/index.ts"
	}
}

Then run:

sh
bun run build

Configuration

Create a bunup.config.ts file for usage like including plugins, hooks, and advanced options that aren't available via CLI.

For example, you can add the exports plugin to automatically sync your package.json exports on each build - no more manual export management!

bunup.config.ts
typescript
import { defineConfig } from 'bunup';
import { exports } from 'bunup/plugins';

export default defineConfig({
	entry: 'src/index.ts',
	plugins: [exports()],
});

You can also export an array of configurations:

bunup.config.ts
typescript
export default defineConfig([
	{
		name: 'node',
		entry: 'src/index.ts',
		format: 'esm',
		target: 'node',
	},
	{
		name: 'browser',
		entry: 'src/index.ts',
		format: ['esm', 'iife'],
		target: 'browser',
		outDir: "dist/browser",
	},
]);

Custom Configuration Path

If you need to use a configuration file with a non-standard name or location, you can specify its path using the --config CLI option:

sh
bunup --config ./configs/custom.bunup.config.ts

Watch Mode

Bunup can watch your files for changes and rebuild automatically:

sh
bunup src/index.ts --watch

Or in package.json:

package.json
json
{
	"name": "my-package",
	"scripts": {
		"build": "bunup src/index.ts",
		"dev": "bunup src/index.ts --watch"
	}
}

Then run:

sh
bun run dev

Released under the MIT License.