tsup
Zero-config TypeScript library bundler powered by esbuild. tsup generates CJS and ESM builds from TypeScript source with type declarations — the standard tool for publishing TypeScript npm libraries. Single config (tsup.config.ts) handles multiple entry points, code splitting, external dependencies, sourcemaps, and declaration files. Produces properly-structured dual CJS/ESM packages for maximum ecosystem compatibility.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Local build tool — no security concerns. esbuild's Rust implementation is memory-safe. Published packages should be audited with npm audit after build.
⚡ Reliability
Best When
You're publishing a TypeScript npm package and want CJS + ESM + .d.ts output with minimal configuration — tsup is the standard choice.
Avoid When
You're bundling an application (use Vite) or need complex Rollup plugin transformations. tsup is optimized for library publishing.
Use Cases
- • Bundle TypeScript npm libraries to publish CJS + ESM + type declarations with a single tsup command
- • Generate properly-structured dual-format npm packages (exports field) for maximum Node.js and bundler compatibility
- • Build TypeScript CLI tools that need a compiled, distributable npm package
- • Replace complex Rollup or webpack configurations for simple library bundling use cases
- • Build TypeScript SDKs and agents that publish to npm with correct module formats
Not For
- • Application bundling (React apps, Next.js) — use Vite, webpack, or framework CLIs for applications
- • Complex build pipelines with custom plugins beyond esbuild — Rollup has a richer plugin ecosystem for complex transforms
- • Non-TypeScript JavaScript libraries — tsup's primary value is TypeScript declaration generation
Interface
Authentication
No authentication — local build tool.
Pricing
MIT-licensed open source tool by Egoist.
Agent Metadata
Known Gotchas
- ⚠ tsup uses esbuild for transpilation — complex TypeScript decorators (emitDecoratorMetadata) may not work correctly; use tsc for type declaration generation separately
- ⚠ Dual CJS+ESM builds require correct package.json 'exports' field configuration — missing exports field causes module resolution issues in consumers
- ⚠ External packages in 'dependencies' should be marked external in tsup config — forgetting this bundles dependencies into the output, inflating size
- ⚠ Type declarations generated by tsup use tsc under the hood — slow for large projects; skip declaration generation with --no-dts for development builds
- ⚠ tsup watch mode rebuilds on file changes but doesn't reload the consuming app — pair with nodemon or tsx watch in dependent apps
- ⚠ CSS and asset bundling is limited — tsup is optimized for TypeScript code; use Vite for assets/CSS bundling
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for tsup.
Scores are editorial opinions as of 2026-03-06.