explaingit

egoist/tsup

11,231TypeScriptAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

A zero-config command-line tool for bundling TypeScript libraries into JavaScript, powered by esbuild for fast builds, though the author now recommends the successor tool tsdown.

Mindmap

mindmap
  root((repo))
    What it does
      Bundles TypeScript libs
      Outputs to dist folder
      Zero config by default
    Powered by
      esbuild for speed
      Node.js runtime
    Supported formats
      JS and MJS output
      JSON and TSX files
      CSS experimental
    Status
      No longer maintained
      Migrate to tsdown
      MIT license
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Bundle a TypeScript npm package into distributable JavaScript with a single command and no config file.

USE CASE 2

Build multiple library entry points at once and output them to a dist folder ready for publishing.

USE CASE 3

Migrate an existing tsup-based project to the recommended replacement tool tsdown using the linked migration guide.

Tech stack

TypeScriptesbuildNode.js

Getting it running

Difficulty · easy Time to first run · 5min

Project is no longer actively maintained, the author recommends migrating to tsdown.

MIT license, use freely for any purpose, including commercial projects, as long as you keep the copyright notice.

In plain English

tsup is a command-line tool for bundling TypeScript libraries into distributable JavaScript files. It is designed to require no configuration for typical use cases, making it quick to set up compared to tools that need extensive configuration files before they will run. The tool is powered by esbuild, a JavaScript bundler known for fast build times. You point tsup at one or more TypeScript source files and it outputs compiled JavaScript files into a dist folder. It supports common file types that Node.js handles natively, including .js.mjs, and .json, along with .ts and .tsx TypeScript files. CSS bundling is noted as experimental. Installing tsup is done via npm, yarn, or pnpm as a development dependency in your project. Once installed, you can run it directly from the command line or add it to the scripts section of your package.json. No separate configuration file is required for common scenarios, though configuration options are available for more specific setups. Basic usage is a single command: tsup src/index.ts. Multiple entry files can be provided at once, and each produces a corresponding output file in the dist directory. Full configuration options and documentation are available on the project website. The README includes a prominent warning: the project is no longer actively maintained. The author recommends switching to a tool called tsdown instead, and a migration guide is linked. This is worth noting if you are evaluating tsup for a new project. The project is MIT-licensed and accumulated over 11,000 GitHub stars during its active period.

Copy-paste prompts

Prompt 1
I have a TypeScript library at src/index.ts and I want to bundle it with tsup. Show me the minimal package.json scripts setup and the tsup command to output to dist/.
Prompt 2
How do I configure tsup to bundle multiple entry files and output both CommonJS and ESM formats?
Prompt 3
I'm migrating from tsup to tsdown. What are the main differences and how do I update my build config?
Open on GitHub → Explain another repo

← egoist on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.