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

> tsdx@2.0.0 is ESM-only. ESM-only — it has never shipped a CommonJS build.

Zero-config TypeScript package development

Last verified Sep 9, 2026 against tsdx@2.0.0.

tsdx has been ESM-only since its first stable release; there is no CommonJS version to pin.

require("tsdx") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. Node.js 18 has no require(esm), and tsdx@2.0.0 declares Node.js >=20, so 18 is outside its supported range anyway.

tsdx@2.0.0 declares engines ">=20", so Node.js 18 is outside its supported range regardless of module format.

## What to do

1. require("tsdx") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it.
2. From a CommonJS file, use a dynamic import inside an async function: const tsdx = await import("tsdx"). That works on every Node.js version the package supports (>=20).
3. There is no CommonJS release of tsdx to pin; without require(esm) the only option is a dynamic import().
4. tsdx@2.0.0 declares engines ">=20", so Node.js 18 is unsupported regardless: upgrade Node.js or pin an older release.
5. TypeScript: types are bundled; install nothing extra.

## Facts

- Latest: 2.0.0 (Dec 29, 2025)
- Module format: ESM-only
- Last CommonJS version: none
- ESM-only since: 2.0.0 (Dec 29, 2025)
- TypeScript types: bundled
- Node engines: >=20
- Weekly downloads: 49K
- License: MIT

## Runtime test results for tsdx@2.0.0

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

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

## How to import tsdx

ES modules:

```js
import * as tsdx from "tsdx";
```

Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.

CommonJS:

```js
// require("tsdx") failed in our probe on Node.js 20.19+, 22.12+ and newer as well (ERR_PACKAGE_PATH_NOT_EXPORTED); see the runtime table.

// Any Node.js version the package supports (>=20), from an async function:
async function main() {
  const tsdx = await import("tsdx");
}
```

## Module format by version

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

| Versions | Format | First published |
|---|---|---|
| 2.0.0 | ESM-only | Dec 29, 2025 |
| 0.1.0 – 0.14.1 | No JS entry point | Jan 24, 2019 |

## Frequently asked

**Is tsdx ESM-only?**

tsdx@2.0.0 is ESM-only. tsdx has been ESM-only since its first stable release; there is no CommonJS version to pin.

**Which version of tsdx still supports CommonJS / require()?**

None. tsdx has always been ESM-only. Use import, or a dynamic import("tsdx") from an async function in CommonJS.

**How do I use tsdx from a CommonJS file?**

From a CommonJS file, use a dynamic import inside an async function: const tsdx = await import("tsdx"). That works on every Node.js version the package supports (>=20). require("tsdx") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it.

**Does tsdx work in Bun?**

Importing tsdx failed in Bun 1.4.0 on Sep 9, 2026: Usage: tsdx [options] [command]

**Does tsdx ship TypeScript types?**

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

## Links

- [tsdx on npm](https://www.npmjs.com/package/tsdx)
- [Source repository](https://github.com/jaredpalmer/tsdx)
- [HTML version](https://canirequire.com/package/tsdx/)
- [JSON version](https://canirequire.com/package/tsdx.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.
