canirequire

canirequire › ESM-only › tsdx

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

Zero-config TypeScript package development

Last verified Sep 9, 2026 against tsdx@2.0.0. Markdown · JSON

ESM-only ESM-only — it has never shipped a CommonJS build

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.
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

Does tsdx@2.0.0 actually load? Runtime test results

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

Runtimerequire("tsdx")import "tsdx"
Node.js 18✗ failsERR_PACKAGE_PATH_NOT_EXPORTED✗ failsError
Node.js 20✗ failsERR_PACKAGE_PATH_NOT_EXPORTED✗ failsError
Node.js 22✗ failsERR_PACKAGE_PATH_NOT_EXPORTED✗ failsError
Node.js 24✗ failsERR_PACKAGE_PATH_NOT_EXPORTED✗ failsError
Node.js 26✗ failsERR_PACKAGE_PATH_NOT_EXPORTED✗ failsError
Bun 1.4.0✗ failsError✗ failsError

How to import tsdx

ES modules (import)

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 (require)

// 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, corrected where a runtime test of that version contradicted them (56 versions; the newest 56 shown).

VersionsFormatFirst published
2.0.0ESM-onlyDec 29, 2025
0.1.0 – 0.14.1No JS entry pointJan 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

Other esm-only packages

Similar popularity