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

> espree@11.2.0 ships CommonJS and ESM builds. Dual package — require() works on every Node.js version we test; import works too.

An Esprima-compatible JavaScript parser built on Acorn

Last verified Sep 9, 2026 against espree@11.2.0.

espree publishes both a CommonJS entry and a native ESM entry (ESM added in 8.0.0). require("espree") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js ^20.19.0 || ^22.13.0 || >=24. import "espree" works alongside it.

## What to do

1. Nothing to change. require("espree") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js ^20.19.0 || ^22.13.0 || >=24. import * as espree from "espree" works alongside it; use named imports for what the ESM entry exports.
2. TypeScript: types are bundled; install nothing extra.

## Facts

- Latest: 11.2.0 (Mar 6, 2026)
- Module format: Dual (CommonJS + ESM)
- Last CommonJS version: 11.2.0
- Native ESM since: 8.0.0
- TypeScript types: bundled
- Node engines: ^20.19.0 || ^22.13.0 || >=24
- Weekly downloads: 115.4M
- License: BSD-2-Clause

## Runtime test results for espree@11.2.0

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

| Runtime | require("espree") | import "espree" |
|---|---|---|
| Node.js 18 | works | 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 espree

ES modules:

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

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

CommonJS:

```js
const espree = require("espree");
```

## Module format by version

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

| Versions | Format | First published |
|---|---|---|
| 8.0.0 – 11.2.0 | Dual (CommonJS + ESM) | Jun 30, 2021 |
| 3.1.1 – 7.3.1 | CommonJS | Feb 26, 2016 |

## Frequently asked

**Is espree ESM-only?**

espree@11.2.0 ships CommonJS and ESM builds. espree publishes both a CommonJS entry and a native ESM entry (ESM added in 8.0.0). require("espree") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js ^20.19.0 || ^22.13.0 || >=24. import "espree" works alongside it.

**Can I require espree?**

Yes. espree ships a CommonJS entry alongside the native ESM entry. require("espree") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js ^20.19.0 || ^22.13.0 || >=24.

**Does espree work in Bun?**

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

**Does espree ship TypeScript types?**

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

## Links

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