tsdown
tsdown — next-generation bundler for TS libraries, powered by rolldown.
Stack Components
Why
Rust-powered rollup, faster than rollup, unbuild-compatible config. Vite 5 builds 10-20x faster than Webpack (esbuild + Rollup core).
Turborepo and Nx cut monorepo CI times by 60-80% via remote caching and task parallelization.
When
Use for TS library builds needing speed. Avoid for app bundling.
How
Example
Common Problems
- ⚠rolldown compat — check rollup plugin support
- ⚠Early stage — API may change
- ⚠Configuration drift between environments — use infrastructure-as-code (Terraform/Pulumi) to keep dev/staging/prod identical
Best Practices
- ✓Use clean option for fresh builds
- ✓Leverage persistent cache
- ✓Set up health checks and graceful shutdown — handle SIGTERM to drain in-flight requests before exit
FAQ
What is tsdown and what projects is it for?
tsdown — next-generation bundler for TS libraries, powered by rolldown. It pairs layered technologies for end-to-end type safety and out-of-the-box deploys, fitting everything from MVPs to production SaaS.
How do I spin up a working demo with tsdown in 10 minutes?
Two steps: (1) npm install tsdown; (2) Create tsdown.config.ts. Get the local dev server running, then wire one real data source to verify the end-to-end loop.
What is the most common pitfall with tsdown and how do I avoid it?
The most common pitfall is: rolldown compat — check rollup plugin support. Avoid it by adding the matching checklist to your PR template and running type-check + lint + unit tests in CI — three gates before merge.
What are the best practices for tsdown?
Best practices for tsdown include: Use clean option for fresh builds; Leverage persistent cache; Set up health checks and graceful shutdown — handle SIGTERM to drain in-flight requests before exit. The first one — "Use clean option for fresh builds" — should be set up at project init to avoid costly rework later.
When should I NOT choose tsdown?
Pick something else in three cases: (1) the team has zero experience with the core framework and the deadline is tight (learning-curve risk); (2) it's a pure content/marketing site (Astro is lighter); (3) you need very high throughput (>10k RPS) or strict-consistency microservices (Go/Rust). tsdown shines for mid-to-high complexity full-stack and API work — don't over-engineer simple static pages with it.