canirequire › ESM-only › puppeteer
Is puppeteer ESM-only? Can you require() it?
A high-level API to control headless Chrome over the DevTools Protocol
Latest version 25.10.0, published Sep 3, 2026. Markdown · JSON
ESM-only ESM-only since 25.0.2 — last CommonJS version is 24.43.1
puppeteer dropped its CommonJS build in 25.0.2 (May 2026). The last version with a plain require()-able CommonJS entry is 24.43.1, published May 11, 2026; it declares support for Node.js >=18.
On Node.js 22.12+ and newer (puppeteer@25.10.0 declares Node.js >=22.12.0), require() of ESM packages usually works unless the package uses top-level await. Node.js 18 has no require(esm), and puppeteer@25.10.0 declares Node.js >=22.12.0, so 18 is outside its supported range anyway.
What to do
- On Node.js 22.12+ and newer (puppeteer@25.10.0 declares Node.js >=22.12.0), require() of ESM packages usually works unless the package uses top-level await.
- From a CommonJS file, use a dynamic import inside an async function: const puppeteer = await import("puppeteer"). That works on every Node.js version the package supports (>=22.12.0).
- If you need a synchronous require() or run Node.js 18: npm install puppeteer@24.43.1, the last CommonJS release (published May 11, 2026); it declares Node.js >=18.
- TypeScript: types are bundled; install nothing extra.
Does puppeteer@25.10.0 actually load? Runtime test results
Runtime probe pending for this version. The values below are what package.json declares; they are refreshed once the probe runs.
| Runtime | require("puppeteer") | import "puppeteer" |
|---|---|---|
| Node.js 18 | ✗ expected | ✓ expected |
| Node.js 20 | depends | ✓ expected |
| Node.js 22 | depends | ✓ expected |
| Node.js 24 | depends | ✓ expected |
| Node.js 26 | depends | ✓ expected |
| Bun 1.4.0 | pending | pending |
Install failed in our sandbox: PROBE_TIMEOUT The rows above show what package.json declares.
How to import puppeteer
ES modules (import)
import * as puppeteer from "puppeteer";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
// Node.js 22.12+ and newer (unless the package uses top-level await):
const puppeteer = require("puppeteer");
// Any Node.js version the package supports (>=22.12.0), from an async function:
async function main() {
const puppeteer = await import("puppeteer");
}
// Or pin the last CommonJS release (declares Node.js >=18):
// npm install puppeteer@24.43.1Module 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 (366 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 25.0.2 – 25.10.0 | ESM-only | May 15, 2026 |
| 24.16.2 – 24.43.1 | Dual (CommonJS + ESM) | Aug 14, 2025 |
Frequently asked
Is puppeteer ESM-only?
puppeteer@25.10.0 is ESM-only. puppeteer dropped its CommonJS build in 25.0.2 (May 2026). The last version with a plain require()-able CommonJS entry is 24.43.1, published May 11, 2026; it declares support for Node.js >=18.
Which version of puppeteer still supports CommonJS / require()?
24.43.1 is the last version of puppeteer with a CommonJS build; it declares Node.js >=18. Install it with "npm install puppeteer@24.43.1". Every version from 25.0.2 on is ESM-only.
How do I use puppeteer from a CommonJS file?
From a CommonJS file, use a dynamic import inside an async function: const puppeteer = await import("puppeteer"). That works on every Node.js version the package supports (>=22.12.0). On Node.js 22.12+ and newer (puppeteer@25.10.0 declares Node.js >=22.12.0), require() of ESM packages usually works unless the package uses top-level await. Alternatively pin puppeteer@24.43.1 (declares Node.js >=18).
Does puppeteer ship TypeScript types?
Yes. puppeteer 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
- class-validator 0.15.1CommonJS
- @nestjs/core 12.0.1ESM-only
- @rushstack/eslint-patch 1.16.1Dual
- mongodb 7.6.0CommonJS
- @nestjs/common 12.0.1ESM-only
- cookie-parser 1.4.7CommonJS
- @babel/plugin-proposal-export-default-from 8.0.1ESM-only
- sinon 22.1.0Dual