tsup

Zero-config TypeScript library bundler powered by esbuild

Tool
npm
v8.5.1
11,301 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
65 /100 Good
Development Activity 48
Maintenance 48
Community 64
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
76 /100 Good
Architecture 75
Code Quality 72
Innovation 70
Learning Curve 85

tsup is a command-line bundler that packages TypeScript and JavaScript libraries with no configuration required. It wraps esbuild for the heavy lifting and layers on library-specific concerns esbuild doesn’t handle out of the box: multiple output formats (CJS, ESM, IIFE) in a single run, .d.ts declaration generation, code splitting, watch mode, and CLI entry bundling.

Because of its no-config defaults and speed, tsup became one of the most widely adopted ways to ship a TypeScript npm package, used by countless open-source libraries as their build step. The README now flags the project as no longer actively maintained, pointing users toward tsdown as a successor, but tsup remains in heavy production use (multi-million weekly npm downloads) and its GitHub issues/discussions stay active.

What You Get

  • Zero-config bundling driven entirely by CLI flags or an optional tsup.config.ts
  • Simultaneous CJS, ESM, and IIFE output from a single build invocation
  • Automatic .d.ts type declaration generation and rollup via API Extractor
  • Watch mode with process restart and on-save rebuilds for CLI development
  • Code splitting, tree-shaking, and shebang/CJS-interop handling for published packages

Common Use Cases

  • Bundling a TypeScript npm library into CJS + ESM before publishing
  • Building a Node.js CLI tool with a shebang-aware executable output
  • Generating rolled-up .d.ts type declarations alongside compiled JS
  • Watch-mode local development for a library consumed by another workspace package

Under The Hood

Architecture - The CLI entry (src/cli-main.ts, src/cli-default.ts) parses flags with cac, resolves an optional tsup.config.ts via bundle-require, then normalizes everything into NormalizedOptions inside src/index.ts. The core build() function fans out per-format esbuild runs coordinated through a PluginContainer (src/plugin.ts) that layers first-party esbuild plugins (shebang, cjs-splitting, swc-target, tree-shaking, size-reporter, terser) around the underlying esbuild calls in src/esbuild/, while a parallel path in src/tsc.ts/src/api-extractor.ts handles .d.ts generation and rollup outside the esbuild pipeline.

Tech Stack - Written in TypeScript targeting Node >=18, with esbuild ^0.27 as the bundling engine, Rollup ^4 used specifically for declaration-file rollup, chokidar/tinyglobby for watch and glob resolution, and optional peer dependencies (@swc/core, @microsoft/api-extractor, postcss, typescript) that unlock SWC transforms, API Extractor dts rollup, and PostCSS/Sass processing only when installed.

Code Quality - The test/ directory holds ten Vitest suites (index, css, dts, experimental-dts, svelte, graphql, shims, tsconfig, example) run via vitest run after a full build, covering most declared output modes; core modules use explicit TypeScript types (NormalizedOptions, Options) and a dedicated PrettyError/handleError path for user-facing failures, though inline code comments are sparse outside of edge-case explanations like the Windows taskkill handling in src/index.ts.

API Design - The public surface is deliberately small: a defineConfig() helper for config-file authors and CLI flags for everyone else, with sensible defaults (outDir: 'dist', CJS format) so a bare tsup src/index.ts produces a working build; the tradeoff is that discovering the full breadth of options (dts modes, splitting, multi-entry objects) requires consulting the external docs site rather than in-editor discovery, since most configuration is CLI-flag-driven rather than a single typed options object.

Used by 84 apps in this directory

TypeScript
98%
Other

Novu

Developer Tools

40,084

Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.

View details
93
Repo Health
80
Technical
64
Dependency
Built with
TypeScript 98%
Updated 6 days ago
TypeScript
95%
MIT

OmniRoute

AI Agents

70,824

A free, open-source AI gateway connecting Claude Code, Codex, Cursor, Cline, and Copilot to 237 AI providers (90+ free) through one endpoint, with automatic fallback and token-compression to stretch free-tier limits further.

View details
86
Repo Health
70
Technical
71
Dependency
Built with
TypeScript 95%
Updated 6 days ago
Python
64%
Other

Onyx

AI Agents · AI Assistants · Knowledge Management

32,262

Self-hostable AI platform with agentic RAG, 50+ connectors, deep research, code execution, and support for every major LLM provider.

View details
92
Repo Health
83
Technical
68
Dependency
Built with
Python 64%
TypeScript 26%
Updated 6 days ago
TypeScript
82%
AGPL 3.0

OpenStatus

Devops · Monitoring

9,143

Open-source status pages and uptime monitoring with global synthetic checks, monitoring-as-code, and AI agent integration via MCP.

View details
77
Repo Health
82
Technical
69
Dependency
Built with
TypeScript 82%
MDX 15%
Updated 6 days ago
Rust
97%
Apache 2.0

codex

AI Code Assistants · Developer Tools

126,822

OpenAI's open-source CLI coding agent that reads, edits, and runs code in your terminal using natural language prompts.

View details
89
Repo Health
80
Technical
75
Dependency
Built with
Rust 97%
Updated 5 days ago
TypeScript
88%
AGPL 3.0

OpenPanel

Analytics

7,057

Open-source Mixpanel alternative with session replay, MCP integration, and privacy-first product analytics you fully control.

View details
74
Repo Health
74
Technical
65
Dependency
Built with
TypeScript 88%
MDX 10%
Updated 1 weeks ago
HTML
36%

OpenPanel

Devops · Hosting Control Panel

749

Docker-powered web hosting control panel that gives every user a fully isolated environment with dedicated web server, database, and networking — VPS-grade security on shared hardware.

View details
84
Repo Health
75
Technical
63
Dependency
Built with
HTML 36%
Go 32%
TypeScript 23%
Updated 6 days ago
Rust
91%
MIT

OpenPencil

AI Design Tools

6,029

An open-source, AI-native vector design tool with concurrent agent teams, design-as-code, a built-in MCP server, and multi-model intelligence — a distinct project from the similarly-named Figma-file-reading "open-pencil" editor.

View details
81
Repo Health
70
Technical
75
Dependency
Built with
Rust 91%
Updated 6 days ago
TypeScript
93%
MIT

OpenReel Video

Video Editors

5,211

A browser-based, GPU-accelerated video editor with multi-track timelines, color grading, and 4K export — no uploads, no installs, no watermarks.

View details
66
Repo Health
80
Technical
74
Dependency
Built with
TypeScript 93%
Updated 1 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers