Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Bun 10 min read Announcement mediumAdept

The Bun Bundler

Bun now ships a native bundler in beta, exposed as the `bun build` CLI and the `Bun.build()` JavaScript API. It shares one plugin API with the runtime, returns Blob-compatible build artifacts, can compile standalone executables, and supports browser, bun and node targets. Bundles built for the bun target carry a `// @bun` pragma so the runtime skips re-transpilation. It includes tree shaking (sideEffects, __PURE__, NODE_ENV/--define, ESM and limited CommonJS-to-ESM conversion), source maps and a new minifier, and it benchmarks at 1.75x faster than esbuild and 220x faster than Webpack on a three.js workload. Only ESM output is supported for now, and its architecture follows esbuild's design.

Related posts

  • Bun v1.3.6

    Bun mediumAdept

    Bun v1.3.6 adds a built-in Bun.Archive API for creating and extracting tar/gzip archives, a native Bun.JSONC parser, and new Bun.build options for esbuild-compatible metafiles, virtual in-memory files, local cross-compile executables and React Fast Refresh. Performance work makes Response.json() 3.5x faster by hitting JavaScriptCore's SIMD FastStringifier path and makes Buffer.indexOf up to 2x faster with SIMD. Bun.hash.crc32 is about 20x faster via hardware CRC instructions, and a spawnSync regression on Linux ARM64 is fixed by correctly defining the close_range syscall. Other changes include WebSocket proxy support, S3 Requester Pays, fake-timer fixes for testing-library, sql() INSERT handling of undefined values, and Node.js compatibility bugfixes.

  • Bun v0.1.11

    Bun mediumAdept

    Bun v0.1.11 adds a runtime plugin API, loosely modeled on esbuild's, that lets code import file types Bun has no built-in loader for (such as .svelte, .vue, .yaml, .mdx) and dynamically generate ESM/CJS modules, with examples for MDX and YAML loaders. The release also expands Node compatibility with a native os module, EventEmitter, StringDecoder, Buffer methods and N-API fixes. On macOS, the event loop moves to a more reliable polling mechanism that cuts setTimeout CPU usage from 90% to 33% and fixes fetch race-condition hangs, and React SSR runs about 2x faster.

  • Bun v1.3.1

    Bun mediumAdept

    Bun v1.3.1 makes `bun build` up to 2x faster for symlink-heavy projects (isolated linker, pnpm). It also adds sourcemaps for legal comments and inlines `import.meta` fields as CommonJS equivalents when building with `--format=cjs`. `bun test` gains a global Vitest-compatible `vi`, `--pass-with-no-tests` and `--only-failures`. `bun install` drops an unnecessary peer-dependency sleep, supports `:email` in `.npmrc` and selective hoisting via `publicHoistPattern`/`hoistPattern`. The release also adds `FileHandle.readLines()` and a long list of fixes, including fuzzer-found memory-safety bugs reported by Cloudflare, a MySQL TLS busy-loop, and determinism issues in isolated installs.

  • Bun v1.1.30

    Bun mediumAdept

    Bun v1.1.30 adds an experimental CSS parser and bundler, a LightningCSS port rewritten from Rust to Zig. It flattens @import chains and CSS imported from JS/TS module graphs into one file per entrypoint. `bun build --bytecode` precompiles to JavaScriptCore bytecode for about 2x faster startup, at the cost of files up to 8x larger, with source kept as a fallback for async functions, generators and eval. Other changes include `bun publish` as a drop-in for `npm publish` with workspace version rewriting, CommonJS output, BoringSSL-backed RSA functions that run 30x faster, zombie-process cleanup on `bun test` timeouts, and a prototype-pollution mitigation that makes native APIs ignore Object.prototype.

  • Bun v1.2.17

    Bun mediumAdept

    Bun v1.2.17 adds ahead-of-time bundling for HTML imports in server code, so `bun build --target=bun` or `--compile` can produce a full-stack build or a single self-contained executable with no runtime bundling. Bun Shell no longer uses the native call stack, which prevents stack overflows in deeply nested scripts. Removing a pointer indirection in Strong references cuts per-timer memory for `setTimeout` and `setImmediate` by 8-15%. Other changes include `columnTypes`/`declaredTypes` in `bun:sqlite`, zstd in `node:zlib`, `--unhandled-rejections` modes, `child_process.fork` `execArgv`, and a JavaScriptCore upgrade bringing JIT string and array optimizations, a zero-copy JSON stringifier and WebAssembly interpreter hardening.

The quest for software engineering knowledge.

Look:
Layout: