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
- require("tsdx") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it.
- 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).
- There is no CommonJS release of tsdx to pin; without require(esm) the only option is a dynamic import().
- tsdx@2.0.0 declares engines ">=20", so Node.js 18 is unsupported regardless: upgrade Node.js or pin an older release.
- TypeScript: types are bundled; install nothing extra.
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.
| Runtime | require("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).
| 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
Other esm-only packages
- ansi-styles 7.0.0last CJS
5.2.0 - strip-ansi 7.2.0last CJS
6.0.1 - commander 15.0.0last CJS
14.0.3 - supports-color 11.0.0last CJS
8.1.1 - chalk 6.0.0last CJS
4.1.2 - string-width 8.2.2last CJS
4.2.3 - ansi-regex 6.3.0last CJS
5.0.1 - escape-string-regexp 5.0.0last CJS
4.0.0
Similar popularity
- @oclif/dev-cli 1.26.10CommonJS
- rollup-plugin-serve 3.0.0Dual
- ember-disable-prototype-extensions 1.1.3CommonJS
- gulp-minify-css 1.2.4CommonJS
- jasmine-node 3.0.0CommonJS
- karma-browserify 8.1.0CommonJS
- dumi 2.4.49CommonJS
- babel-preset-latest 6.24.1CommonJS