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

> estree-walker@3.0.3 is ESM-only. ESM-only since 3.0.0 — last CommonJS version is 2.0.2.

Traverse an ESTree-compliant AST

Last verified Sep 9, 2026 against estree-walker@3.0.3.

estree-walker dropped its CommonJS build in 3.0.0 (January 2021). The last version with a plain require()-able CommonJS entry is 2.0.2, published Dec 8, 2020.

require("estree-walker") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. On Node.js 18, which has no require(esm), require("estree-walker") fails with ERR_REQUIRE_ESM.

## What to do

1. require("estree-walker") 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 estreeWalker = await import("estree-walker"). That works on every Node.js version the package supports.
3. If you need a synchronous require() or run Node.js 18: npm install estree-walker@2.0.2, the last CommonJS release (published Dec 8, 2020).
4. TypeScript: types are bundled; install nothing extra.

## Facts

- Latest: 3.0.3 (Jan 20, 2023)
- Module format: ESM-only
- Last CommonJS version: 2.0.2
- ESM-only since: 3.0.0 (Jan 29, 2021)
- TypeScript types: bundled
- Node engines: not declared
- Weekly downloads: 159.5M
- License: MIT

## Runtime test results for estree-walker@3.0.3

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

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

## How to import estree-walker

ES modules:

```js
import * as estreeWalker from "estree-walker";
```

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

CommonJS:

```js
// require("estree-walker") 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, from an async function:
async function main() {
  const estreeWalker = await import("estree-walker");
}

// Or pin the last CommonJS release:
// npm install estree-walker@2.0.2
```

## Module format by version

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

| Versions | Format | First published |
|---|---|---|
| 3.0.0 – 3.0.3 | ESM-only | Jan 29, 2021 |
| 2.0.2 | Dual (CommonJS + ESM) | Dec 8, 2020 |
| 0.1.0 – 2.0.1 | CommonJS | Apr 9, 2015 |

## Frequently asked

**Is estree-walker ESM-only?**

estree-walker@3.0.3 is ESM-only. estree-walker dropped its CommonJS build in 3.0.0 (January 2021). The last version with a plain require()-able CommonJS entry is 2.0.2, published Dec 8, 2020.

**Which version of estree-walker still supports CommonJS / require()?**

2.0.2 is the last version of estree-walker with a CommonJS build. Install it with "npm install estree-walker@2.0.2". Every version from 3.0.0 on is ESM-only.

**How do I use estree-walker from a CommonJS file?**

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

**Does estree-walker work in Bun?**

Yes. import "estree-walker" loaded successfully in Bun 1.4.0 on Sep 9, 2026.

**Does estree-walker ship TypeScript types?**

Yes. estree-walker bundles its own type declarations; no @types package is needed.

## Links

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