Skip to content

Bun快速 JavaScript

Bun 是一个快速的 JavaScript 运行时。

Bun 3.3
Bundling 10,000 React components
Build time in milliseconds (Linux x64, Hetzner)
Bun v1.3.0
269.1 ms
Rolldown v1.0.0-beta.42
494.9 ms
esbuild v0.25.10
571.9 ms
Farm v1.0.5
1608 ms
Rspack v1.5.8
2137 ms

Four tools, one toolkit

Use them together as an all-in-one toolkit, or adopt them incrementally. bun test works in Node.js projects. bun install can be used as the fastest npm client. Each tool stands on its own.

Node.js

JavaScript Runtime

Starts 3x faster than Node.js

A fast JavaScript runtime designed as a drop-in replacement for Node.js

$ bun ./index.ts
Node.js API compatibility
Comprehensive builtin standard library
Hot & watch mode built-in
TypeScript, JSX & React (zero config)
PostgreSQL, Redis, MySQL, SQLite
Environment variables with .env
NPM

Package Manager

30x faster

Install packages up to 30x faster than npm with a global cache and workspaces

$ bun install
Simple migration from npm/pnpm/yarn
Workspaces, monorepos
Dependency auditing with bun audit
Eliminate phantom dependencies
Lifecycle scripts & postinstall handling
Block malicious packages
VITEST

Test Runner

Jest & Vitest

Jest-compatible test runner with built-in code coverage and watch mode

$ bun test
Jest-compatible expect() API
Watch mode & lifecycle hooks
Concurrent test execution
Snapshot testing
DOM APIs via happy-dom
Built-in code coverage
VITE

Bundler

Vite and esbuild

Bundle TypeScript, JSX, React & CSS for both browsers and servers

$ bun build ./app.tsx
TypeScript & JSX built-in (no config)
React support out of the box
Single-file executables
CSS imports & bundling
Build for the browser, Bun, and Node.js
.html, .css, .ts, .tsx, .jsx & more

Bun学习网由www.bunjs.com.cn整理维护