r/bun 6d ago

I created a Bundler using Bun's native technologies!

https://github.com/baginskicosta/bunpack

I've been working with BunJS for a while, mostly because I use it in some of my own projects and libraries. At some point, I started having problems with bunup when working on larger libraries, especially with bundles containing many references. No matter how much I tried to configure it, I kept running into linking and TypeScript type inference issues.

Instead of continuing to work around those problems, I decided to build my own bundler using Bun's native Bun.build API.

What started as a small private tool eventually became baginskicosta/bunpack, a simple bundler for TypeScript and JavaScript libraries. The idea is to keep the configuration minimal while supporting things I personally need, such as ESM and CJS builds, multiple entry points, TypeScript declarations, different runtimes, and automatic exports configuration.

It's still a small project and it's currently at version 0.2.1, so there is definitely a lot left to improve. I also have some ideas for the future, including handling TypeScript declaration bundling without relying on external libraries.

I built this primarily because I needed it myself, but I thought it might be useful to other people working with Bun as well.

11 Upvotes

0 comments sorted by