# Is tsup ESM-only? Can you require() it?

> tsup@8.5.1 declares a CommonJS entry, but require() fails at runtime. CommonJS on paper — require() failed in our runtime test.

Bundle your TypeScript library with no config, powered by esbuild

Last verified Sep 9, 2026 against tsup@8.5.1.

tsup declares a CommonJS entry only, but require("tsup") failed on every Node.js version in our probe: Cannot find module 'typescript'. import "tsup" resolves to the same file, so it fails the same way. That usually means a missing peer dependency, a browser-only global, or a package that is not meant to be loaded directly; see the runtime table below.

## What to do

1. require("tsup") failed in our probe on every Node.js version (Cannot find module 'typescript'); check the package README for peer dependencies or setup before relying on it.
2. From ES modules use the default import: import tsup from "tsup"; then destructure. Named imports only work when Node.js can statically detect the exports.
3. TypeScript: types are bundled; install nothing extra.

## Facts

- Latest: 8.5.1 (Nov 12, 2025)
- Module format: CommonJS
- Last CommonJS version: 8.5.1
- TypeScript types: bundled
- Node engines: >=18
- Weekly downloads: 5.9M
- License: MIT

## Runtime test results for tsup@8.5.1

Installed and executed on Sep 9, 2026 with require("tsup") from a CommonJS file and import "tsup" from an ES module.

| Runtime | require("tsup") | import "tsup" |
|---|---|---|
| Node.js 18 | fails (MODULE_NOT_FOUND) | fails (MODULE_NOT_FOUND) |
| Node.js 20 | fails (MODULE_NOT_FOUND) | fails (MODULE_NOT_FOUND) |
| Node.js 22 | fails (MODULE_NOT_FOUND) | fails (MODULE_NOT_FOUND) |
| Node.js 24 | fails (MODULE_NOT_FOUND) | fails (MODULE_NOT_FOUND) |
| Node.js 26 | fails (MODULE_NOT_FOUND) | fails (MODULE_NOT_FOUND) |
| Bun 1.4.0 | fails (Error) | fails (Error) |

## How to import tsup

ES modules:

```js
import tsup from "tsup";
```

CommonJS:

```js
// require("tsup") failed in our probe on every Node.js version we test (Cannot find module 'typescript'); see the runtime table.
const tsup = require("tsup");
```

## Module format by version

Derived from the type, main and exports fields of every stable release on npm (204 versions; the newest 60 shown).

| Versions | Format | First published |
|---|---|---|
| 5.11.4 – 8.5.1 | CommonJS | Dec 14, 2021 |

## Frequently asked

**Is tsup ESM-only?**

tsup@8.5.1 declares a CommonJS entry, but require() fails at runtime. tsup declares a CommonJS entry only, but require("tsup") failed on every Node.js version in our probe: Cannot find module 'typescript'. import "tsup" resolves to the same file, so it fails the same way. That usually means a missing peer dependency, a browser-only global, or a package that is not meant to be loaded directly; see the runtime table below.

**Can I require tsup?**

Not in practice. tsup declares a CommonJS entry, but require("tsup") failed on every Node.js version in our probe: Cannot find module 'typescript'. Check the package README for peer dependencies or setup before relying on it.

**Can I import tsup with ES module syntax?**

Yes. import tsup from "tsup" works in Node.js and Bun because they support importing CommonJS modules. Named imports work only when Node.js can statically detect the exports.

**Does tsup work in Bun?**

Importing tsup failed in Bun 1.4.0 on Sep 9, 2026: error: Cannot find package 'typescript' from '/Users/boat/Projects/top-seo/data/probe-work/tsup/node_modules/tsup/dist/index.js'

**Does tsup ship TypeScript types?**

Yes. tsup bundles its own type declarations; no @types package is needed.

## Links

- [tsup on npm](https://www.npmjs.com/package/tsup)
- [Source repository](https://github.com/egoist/tsup)
- [HTML version](https://canirequire.com/package/tsup/)
- [JSON version](https://canirequire.com/package/tsup.json)

---

For scripts and AI agents: any package is at https://canirequire.com/package/<name>/index.md (Markdown) or https://canirequire.com/package/<name>.json (JSON); the site index is https://canirequire.com/llms.txt. Fetch the URL directly; no search needed.
