An open API service indexing awesome lists of open source software.

https://github.com/arshad-yaseen/bunup

Bundling your Javascript or TypeScript libraries has never been simpler or faster—thanks to Bun.
https://github.com/arshad-yaseen/bunup

build-tool bun bundler typescript

Last synced: over 1 year ago
JSON representation

Bundling your Javascript or TypeScript libraries has never been simpler or faster—thanks to Bun.

Awesome Lists containing this project

README

          

![Og](https://bunup.arshadyaseen.com/og.png)

## Benchmarks

Bunup outperforms other popular bundlers by a significant margin:

| Bundler | Format | Build Time | Relative Speed |
| ------------- | -------- | ----------- | ---------------- |
| bunup | esm, cjs | **3.65ms** | **16.0x faster** |
| bunup (+ dts) | esm, cjs | **36.44ms** | **20.4x faster** |
| tsup | esm, cjs | 58.36ms | baseline |
| tsup (+ dts) | esm, cjs | 745.23ms | baseline |

_Lower build time is better. Benchmark run on the same code with identical output formats._

## Prerequisites

Bunup requires [Bun](https://bun.sh) to be installed on your system. Bun is a fast all-in-one JavaScript runtime that powers Bunup's exceptional performance. Without Bun, Bunup cannot execute as it leverages Bun's bundling capabilities and runtime environment.

To install Bun, please visit the [official Bun installation page](https://bun.sh/docs/installation).

## Quick Start

### Installation

```bash
npm install --save-dev bunup
```

### Basic Usage

Create a simple TypeScript file:

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

Bundle it with bunup:

```bash
bunup src/index.ts
```

This will create a bundled output in the `dist` directory.

### Using with package.json

Add a build script to your `package.json`:

```json
{
"name": "my-package",
"scripts": {
"build": "bunup src/index.ts --format esm,cjs --dts"
}
}
```

Then run:

```bash
npm run build
```

### Configuration File

Create a `bunup.config.ts` file for more control:

```typescript
import {defineConfig} from 'bunup';

export default defineConfig({
entry: ['src/index.ts'],
outDir: 'dist',
format: ['esm', 'cjs'],
dts: true,
minify: true,
});
```

## Documentation

For complete documentation, visit [the full documentation](https://bunup.arshadyaseen.com/).

## Contributing

For guidelines on contributing, please read the [contributing guide](https://github.com/arshad-yaseen/bunup/blob/main/CONTRIBUTING.md).

We welcome contributions from the community to enhance Bunup's capabilities and make it even more powerful. ❤️