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

> del@8.0.1 is ESM-only. ESM-only since 7.0.0 — last CommonJS version is 6.1.1.

Delete files and directories

Last verified Sep 9, 2026 against del@8.0.1.

del dropped its CommonJS build in 7.0.0 (July 2022). The last version with a plain require()-able CommonJS entry is 6.1.1, published May 24, 2022; it declares support for Node.js >=10.

On Node.js 20.19+, 22.12+ and newer, require("del") works with the latest version: Node.js loads synchronous ES modules through require(). Verified on Node.js 20, 22, 24 and 26. On Node.js 18, which has no require(esm), require("del") fails with ERR_REQUIRE_ESM.

## What to do

1. On Node.js 20.19+, 22.12+ and newer, require("del") works with the latest version: Node.js loads synchronous ES modules through require(). Verified on Node.js 20, 22, 24 and 26.
2. From a CommonJS file, use a dynamic import inside an async function: const del = await import("del"). That works on every Node.js version the package supports (>=18).
3. If you need a synchronous require() or run Node.js 18: npm install del@6.1.1, the last CommonJS release (published May 24, 2022); it declares Node.js >=10.
4. TypeScript: types are bundled; install nothing extra.

## Facts

- Latest: 8.0.1 (Sep 18, 2025)
- Module format: ESM-only
- Last CommonJS version: 6.1.1
- ESM-only since: 7.0.0 (Jul 19, 2022)
- TypeScript types: bundled
- Node engines: >=18
- Weekly downloads: 11.7M
- License: MIT

## Runtime test results for del@8.0.1

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

| Runtime | require("del") | import "del" |
|---|---|---|
| Node.js 18 | fails (ERR_REQUIRE_ESM) | works |
| Node.js 20 | works | works |
| Node.js 22 | works | works |
| Node.js 24 | works | works |
| Node.js 26 | works | works |
| Bun 1.4.0 | works | works |

## How to import del

ES modules:

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

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

CommonJS:

```js
// Node.js 20.19+, 22.12+ and newer (verified):
const del = require("del");

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

// Or pin the last CommonJS release (declares Node.js >=10):
// npm install del@6.1.1
```

## Module format by version

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

| Versions | Format | First published |
|---|---|---|
| 7.0.0 – 8.0.1 | ESM-only | Jul 19, 2022 |
| 0.1.0 – 6.1.1 | CommonJS | Jun 21, 2014 |

## Frequently asked

**Is del ESM-only?**

del@8.0.1 is ESM-only. del dropped its CommonJS build in 7.0.0 (July 2022). The last version with a plain require()-able CommonJS entry is 6.1.1, published May 24, 2022; it declares support for Node.js >=10.

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

6.1.1 is the last version of del with a CommonJS build; it declares Node.js >=10. Install it with "npm install del@6.1.1". Every version from 7.0.0 on is ESM-only.

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

From a CommonJS file, use a dynamic import inside an async function: const del = await import("del"). That works on every Node.js version the package supports (>=18). On Node.js 20.19+, 22.12+ and newer, require("del") works with the latest version: Node.js loads synchronous ES modules through require(). Verified on Node.js 20, 22, 24 and 26. Alternatively pin del@6.1.1 (declares Node.js >=10).

**Does del work in Bun?**

Yes. import "del" loaded successfully in Bun 1.4.0 on Sep 9, 2026.

**Does del ship TypeScript types?**

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

## Links

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