Guide
Alternatives to esbuild, Rollup and tsup



Compare alternatives to esbuild and Rollup: tsdown, Rolldown, Vite, SWC and more. Check maintenance, library fit and migration risks before replacing tsup.
Contents
Contents
For alternatives to esbuild and Rollup, start with tsdown for TypeScript libraries or Rolldown for a configurable bundler API. Vite library mode suits browser libraries with a demo workflow. tsup's README says it is no longer actively maintained, so new packages should evaluate maintained options while existing tsup users test a replacement against their published outputs.
Alternatives to esbuild and Rollup
Vite library mode, Rspack, Bun build and Parcel serve different build workflows; SWC fits compilation tasks rather than a complete library-packaging replacement.
| Option | What it is | Best fit to evaluate | Release evidence |
|---|---|---|---|
| tsdown | Rolldown-based library bundler with TypeScript declaration generation | TypeScript packages replacing tsup's packaging workflow | Recent stable release: 0.23.7 |
| Rolldown | Rust-based JavaScript bundler with a Rollup-compatible API | Custom build scripts and Rollup-style plugin integration | Recent stable release: 1.3.4 |
| Vite (library mode) | Development workflow plus library builds through build.lib; Vite 8 uses Rolldown | Browser libraries developed alongside a demo page | Recent stable release: 8.4.0 |
| SWC | Compiler with a CLI for transpiling files and directories | Replacing a transform step when packaging is handled separately | Recent stable core release: 1.16.22 |
| Rspack | Rust-based web bundler with a webpack-oriented API | Applications that need webpack-style configuration | Recent stable core release: 2.3.4 |
| Bun build | Bun's native bundler, available as bun build and Bun.build() | Projects choosing Bun for their build scripts | Recent stable Bun release: 1.4.5 |
| Parcel | Build tool handling HTML, CSS, JavaScript and other assets | Web projects wanting an integrated asset pipeline | Published stable 2.16.4, with no npm deprecation notice |
Maintenance labels describe release evidence, not a support guarantee: the first six projects have stable releases within the past month. Parcel's latest stable release is older, so its npm listing alone does not establish an active release cadence. Best-fit entries are editorial judgments based on the linked documentation, not benchmark rankings.
These are alternatives to evaluate, not interchangeable configuration files. A Rollup-compatible API does not guarantee that every plugin works unchanged. Keep declaration emission, exports maps, asset handling and installed-consumer tests in the migration plan. For an existing tsup package, use the decision matrix below before replacing a working build.
Decision matrix for existing builds and new libraries
| Situation | Decision to evaluate | Declaration generation | Output formats | Migration caveat |
|---|---|---|---|---|
| Existing tsup library with passing consumer tests | Keep the working build while assessing maintenance needs | Preserve and test the existing dts configuration | Retain the formats and filenames your exports map promises | The README notice alone does not establish a package defect; validate a replacement before switching |
| New library with a custom build script | Evaluate direct esbuild if the team will maintain the packaging pipeline | Add a separate declaration step, such as tsc --emitDeclarationOnly | Configure separate ESM and CJS builds if both are required; IIFE is also supported | TypeScript transpilation does not emit types or validate package exports |
| New library needing particular plugins or chunk layouts | Evaluate Rollup against those concrete requirements | Configure TypeScript declaration emission separately from JavaScript bundling | ESM, CJS, IIFE and UMD are among Rollup's outputs | Existing plugins and declaration tooling must work together in your fixture |
| Existing tsup library evaluating tsdown | Test a migration branch rather than assuming equivalent behavior | Compare generated declarations in consuming projects | Verify explicit formats, extensions and every exports target | Follow the documented staged migration and resolve deprecated options before upgrading |
The technical entries above use the esbuild API, TypeScript limitations, Rollup configuration and tsdown migration guide. The keep-versus-change decisions are an editorial framework, not benchmark results. For the migration-specific comparison, continue with tsup vs tsdown vs unbuild.
tsup vs esbuild: packaging convenience and responsibility
The useful distinction is the interface each tool gives a library author. tsup wraps esbuild; its configuration interface exposes package-oriented options such as dts and a list of output formats. Direct esbuild gives you a JavaScript build API; your script owns the rest of the publishing workflow. That difference remains relevant when maintaining an existing tsup project even though its maintenance status changes the decision for a new one.
For example, this is a familiar existing tsup configuration:
// tsup.config.ts — example for an existing project
import { defineConfig } from "tsup";
export default defineConfig({
entry: ["src/index.ts"],
format: ["esm", "cjs"],
dts: true,
sourcemap: true,
clean: true,
splitting: false,
minify: false,
});
The declaration option matters because esbuild strips TypeScript syntax without generating .d.ts files. It also does not type-check the program. A successful JavaScript bundle therefore cannot establish that a library's public types are usable. Keep type checking and declaration validation visible in CI, whichever bundler emits JavaScript.
With direct esbuild, you can make the output calls explicit:
// build.mjs
import * as esbuild from "esbuild";
for (const format of ["esm", "cjs"]) {
await esbuild.build({
entryPoints: ["src/index.ts"],
bundle: true,
format,
platform: "node",
packages: "external",
sourcemap: true,
outfile: `dist/index.${format === "esm" ? "mjs" : "cjs"}`,
});
}
This example deliberately leaves package dependencies external. Change that policy only after deciding which dependencies consumers should install and which should be bundled. Then add a declaration-emission command using your project's TypeScript configuration. Check the resulting file locations rather than assuming the JavaScript and declaration paths match automatically.
If your team already has this machinery, direct esbuild may be a manageable choice. If nobody owns it, a short build script can conceal substantial release work. Count that work when comparing tools: entry discovery, declarations, exports, assets, cleanup, watch behavior and consumer tests all need an owner. Replacing tsup with a raw build call is not a complete migration by itself.
Rollup: evaluate output control and actual plugins
Rollup exposes output configuration, module preservation, chunking, externals and tree-shaking controls. These are useful reasons to evaluate it when a library needs a specific output layout or an existing plugin. They do not establish that Rollup always produces a smaller bundle than another tool.
A component library might need separate entry points and preserved modules:
// rollup.config.mjs
import typescript from "@rollup/plugin-typescript";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
export default {
input: {
index: "src/index.ts",
"components/Button": "src/components/Button/index.ts",
},
output: [
{ dir: "dist/esm", format: "esm", preserveModules: true },
{ dir: "dist/cjs", format: "cjs", preserveModules: true },
],
external: ["react", "react-dom"],
plugins: [nodeResolve(), commonjs(), typescript()],
};
This shows a JavaScript output layout, not a complete package template. Configure declaration emission and inspect the emitted paths before writing the exports map. If you need CSS, custom assets or transformed source files, include the actual plugins in the experiment. A minimal JavaScript fixture cannot prove that a component library's release will work.
Rollup configuration can concentrate these rules in one place, but the configuration still needs maintenance. Keep it when those controls solve a real requirement. Switching away solely because another tool advertises speed can exchange a known working plugin setup for unresolved integration work.
Feature comparison without a universal winner
| Capability | esbuild | Rollup | tsup |
|---|---|---|---|
| TypeScript input | Transpiles without type checking | Use a TypeScript transform/plugin | esbuild-based transpilation |
| Declarations | Separate emitter required | Configure an emitter or declaration plugin | dts option integrates declaration generation |
| ESM and CJS | Separate build calls | Multiple output configurations | Multiple formats in one configuration |
| Browser global output | IIFE | IIFE and UMD | IIFE; do not assume UMD support |
| Output layout | Build API and naming options | Chunk and module-preservation controls | Package-oriented wrapper options |
| Plugin integration | esbuild plugin API | Rollup plugin API | Existing esbuild integration; verify custom hooks |
| Maintenance consideration | Own the surrounding build script | Own the config and plugin integration | README says no longer actively maintained |
Output formats and declaration handling are observable capabilities. Build speed and consumer bundle size need measurements from your package. Neither table position nor the language used to implement a bundler demonstrates superiority for a particular release workflow.
Declaration files and output formats
Start with your consumers. ESM-only output can be sufficient if it meets your supported environments. Dual ESM/CJS publishing is a support commitment, not a requirement for every npm package. If you support both, test both runtime entry points and the declarations each TypeScript consumer resolves.
esbuild's TypeScript documentation explains the distinction between transpiling code and emitting declarations. A direct esbuild pipeline can pair bundling with:
tsc --declaration --emitDeclarationOnly --declarationDir dist/types
That command uses the project's TypeScript settings; it does not guarantee that the resulting declarations align with both output formats. In particular, a package with conditional exports needs declarations that TypeScript resolves correctly for those conditions. Check root imports and subpath imports from an installed package, not only within the source repository.
For existing tsup projects, retain dts: true or your current declaration strategy until a replacement has passed the same tests. For Rollup, document which step owns declarations. Avoid a release script where several tools write overlapping files into the same directory without a clear order.
File extensions need the same attention. .mjs and .cjs state a module format explicitly; .js interpretation also depends on package metadata. An exports map pointing to yesterday's filenames can break consumers even when the new build succeeds. Compare the packed file list with every declared entry, including types and any CLI entry.
Tree-shaking and consumer bundle size
Rollup's configuration provides controls for side effects, preserved modules and chunks. esbuild documents declaration-level tree shaking and support for side-effect annotations. Use those controls carefully: marking a module as side-effect-free can remove behavior that consumers rely on if the declaration is wrong.
To compare output, build a small consumer importing one public function or component. Repeat with a subpath entry and with an entry that intentionally triggers a side effect. Use the same consumer bundler and settings for each candidate package. Measure the consumer bundle as well as the distributed files; a package's total dist size is not the amount every application downloads.
If you find a difference, inspect the output and dependency graph before attributing it to the bundler. Different externals, minification settings or entry definitions can explain it. This guide does not report a measured size advantage for any of the three tools.
Build speed: compare the full publishing job
Use the release workflow you actually intend to run. A JavaScript-only build is not comparable to another build that also emits declarations, checks types and copies assets. Record the tool versions, machine, cache state and enabled work beside each timing.
| Local check | What it helps establish |
|---|---|
| Existing tsup build with declarations and source maps | Baseline release time and artifact list |
| Direct esbuild plus declaration generation | Cost of the complete replacement pipeline |
| Rollup with required plugins and output formats | Whether output requirements fit the candidate |
| Clean build and repeated build in CI | How caching changes the result in your environment |
Separate installation time from compilation when diagnosing a slow job, then include both when assessing developer wait time. If declaration generation dominates, changing only the JavaScript bundler may leave most of the delay intact. There is no project-independent speed multiplier to apply here.
Vite 8 production builds use Rolldown
For a web application, first check the framework's build workflow. The Vite build guide documents Rolldown configuration for production builds. The Vite 8 migration guide explicitly identifies Rolldown and Oxc as replacements for Rollup and esbuild in Vite 8.
Scope that statement to Vite 8. Older Vite explanations may describe a different implementation. Vite's choice does not require a standalone library to use the same bundler, and it does not prove that a tsup build can move unchanged to a Rolldown-based tool. Application build integration and package publishing have different requirements. The related Bun vs Vite comparison covers a separate application-tooling decision.
Migration and tool selection
Keep an existing tsup build when it meets current consumer requirements and you can own any needed maintenance work. Reassess when a runtime upgrade, a dependency issue or an unsupported feature creates a concrete problem. The README's maintenance notice is a planning input; it is not evidence that every package built with tsup has a security vulnerability.
For a new library, evaluate the supported environments, declaration strategy and required plugins before selecting a tool. Direct esbuild and Rollup remain options with different integration responsibilities. tsdown is another candidate to test, not an automatic replacement established by the tsup notice.
If evaluating tsdown, follow its current migration documentation rather than renaming the config and assuming completion. The migration documentation describes a staged upgrade through v0.22.14 before v0.23 or later. Compare output files, types, exports and consumer behavior on a branch. The tsup, tsdown and unbuild guide gives the migration checks in more detail.
For a broader inventory after defining your requirements, see TypeScript-first build tools. Keep the decision tied to a working package fixture rather than popularity totals or an assumed winner.
Source notes
Primary documentation supports tool capabilities and status. The decision matrices are editorial frameworks, with no measured speed or size winner:
- tsup README and configuration interface: maintenance notice, esbuild-based positioning, declaration option and supported formats.
- esbuild API and TypeScript documentation: formats, tree shaking and declaration limitations.
- Rollup configuration: formats, externals and output controls.
- Vite guide and Vite 8 migration: version-scoped Rolldown context.
- tsdown migration documentation: staged migration caveats, not independent performance evidence.
- Alternative capabilities: tsdown introduction, Rolldown, Vite library mode, SWC CLI, Rspack introduction, Bun bundler and Parcel.
- Release and deprecation evidence: the official npm registry records for tsdown, Rolldown, Vite, SWC core, Rspack core, Bun and Parcel. A published release does not promise future maintenance.