canirequire › CommonJS › tsup
Is tsup ESM-only? Can you require() it?
Bundle your TypeScript library with no config, powered by esbuild
Last verified Sep 9, 2026 against tsup@8.5.1. Markdown · JSON
CommonJS CommonJS on paper — require() failed in our runtime test
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
- 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.
- 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.
- TypeScript: types are bundled; install nothing extra.
Does tsup@8.5.1 actually load? Runtime test results
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 | ✗ failsMODULE_NOT_FOUND | ✗ failsMODULE_NOT_FOUND |
| Node.js 20 | ✗ failsMODULE_NOT_FOUND | ✗ failsMODULE_NOT_FOUND |
| Node.js 22 | ✗ failsMODULE_NOT_FOUND | ✗ failsMODULE_NOT_FOUND |
| Node.js 24 | ✗ failsMODULE_NOT_FOUND | ✗ failsMODULE_NOT_FOUND |
| Node.js 26 | ✗ failsMODULE_NOT_FOUND | ✗ failsMODULE_NOT_FOUND |
| Bun 1.4.0 | ✗ failsError | ✗ failsError |
A failing require() on a CommonJS package usually means the package needs a browser/DOM global, a peer dependency, or a native binary that is not available in a bare Node.js process.
How to import tsup
ES modules (import)
import tsup from "tsup";Named imports from a CommonJS package only work when Node.js can statically detect them. If a named import fails, use the default import and destructure.
CommonJS (require)
// 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, corrected where a runtime test of that version contradicted them (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
Other commonjs packages
- debug 4.4.3CommonJS
- semver 7.8.5CommonJS
- ms 2.1.3CommonJS
- picomatch 4.0.7CommonJS
- ajv 8.20.0CommonJS
- source-map 0.8.0CommonJS
- react-is 19.2.8CommonJS
- readable-stream 4.7.0CommonJS
Similar popularity
- react-select 5.10.2Dual
- mongoose 9.9.5CommonJS
- ncp 2.0.0CommonJS
- electron 44.3.0CommonJS
- vue-router 5.3.1Dual
- lit-element 4.2.2ESM-only
- eslint-plugin-jsdoc 64.3.8ESM-only
- bootstrap 5.3.8CommonJS