canirequire › ESM-only › estree-walker
Is estree-walker ESM-only? Can you require() it?
Traverse an ESTree-compliant AST
Last verified Sep 9, 2026 against estree-walker@3.0.3. Markdown · JSON
ESM-only ESM-only since 3.0.0 — last CommonJS version is 2.0.2
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
- require("estree-walker") 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 estreeWalker = await import("estree-walker"). That works on every Node.js version the package supports.
- 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).
- TypeScript: types are bundled; install nothing extra.
Does estree-walker@3.0.3 actually load? Runtime test results
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 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 20 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 22 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 24 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 26 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Bun 1.4.0 | ✗ failsError | ✓ works |
How to import estree-walker
ES modules (import)
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 (require)
// 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.2Module 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 (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
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
- onetime 8.0.0ESM-only
- fdir 6.5.0Dual
- pnpm 12.3.4No entry
- @babel/core 8.0.1ESM-only
- is-extglob 2.1.1CommonJS
- jsesc 3.1.0CommonJS
- vite 8.2.2ESM-only
- dotenv 17.4.2CommonJS