canirequire › ESM-only › jquery
Is jquery ESM-only? Can you require() it?
JavaScript library for DOM operations
Last verified Sep 9, 2026 against jquery@4.0.0. JSON
ESM-only ESM-only since 4.0.0 — last CommonJS version is 3.7.1
jquery dropped its CommonJS build in 4.0.0 (January 2026). The last version you can require() on every Node.js version, including 18 and older, is 3.7.1, published Aug 28, 2023.
require("jquery") failed in our probe on Node.js 20+ as well. See the runtime matrix below for the exact error.
Does jquery@4.0.0 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("jquery") from a CommonJS file and import "jquery" from an ES module.
| Runtime | require("jquery") | import "jquery" |
|---|---|---|
| Node.js 18 | ✗ failsError: jQuery requires a window with a document | ✗ failsError: jQuery requires a window with a document |
| Node.js 20 | ✗ failsError: jQuery requires a window with a document | ✗ failsError: jQuery requires a window with a document |
| Node.js 22 | ✗ failsError: jQuery requires a window with a document | ✗ failsError: jQuery requires a window with a document |
| Node.js 24 | ✗ failsError: jQuery requires a window with a document | ✗ failsError: jQuery requires a window with a document |
| Node.js 26 | ✗ failsError: jQuery requires a window with a document | ✗ failsError: jQuery requires a window with a document |
| Bun 1.4 | ✗ failserror: jQuery requires a window with a document | ✗ failserror: jQuery requires a window with a document |
How to import jquery
ES modules (import)
import jquery from "jquery";CommonJS (require)
// Node.js 20.19+ / 22.12+ / newer (package has no top-level await):
const jquery = require("jquery");
// Any Node.js version:
const jquery = await import("jquery");
// Or pin the last CommonJS release:
// npm install jquery@3.7.1Module format by version
Derived from the type, main and exports fields of every stable release on npm (46 versions; the newest 46 shown).
| Versions | Format | First published |
|---|---|---|
| 4.0.0 | ESM-only | Jan 18, 2026 |
| 1.5.1 – 3.7.1 | CommonJS | Mar 19, 2011 |
Frequently asked
Is jquery ESM-only?
jquery@4.0.0 is ESM-only. jquery dropped its CommonJS build in 4.0.0 (January 2026). The last version you can require() on every Node.js version, including 18 and older, is 3.7.1, published Aug 28, 2023.
Which version of jquery still supports CommonJS / require()?
3.7.1 is the last version of jquery with a CommonJS build. Install it with "npm install jquery@3.7.1". Every version from 4.0.0 on is ESM-only.
How do I use jquery from a CommonJS file?
Use a dynamic import: const mod = await import("jquery"). On Node.js 20.19+, 22.12+ and newer, a plain require("jquery") also works for ESM packages that do not use top-level await. Alternatively pin jquery@3.7.1.
Does jquery work in Bun?
Importing jquery failed in Bun 1.4 on Sep 9, 2026: error: jQuery requires a window with a document
Does jquery ship TypeScript types?
Not bundled. Install the community types with "npm install -D @types/jquery".
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 - tslib 2.8.1last CJS
2.5.2 - string-width 8.2.2last CJS
4.2.3 - ansi-regex 6.3.0last CJS
5.0.1
Similar popularity
- ramda 0.32.0Dual
- redis 6.2.1CommonJS
- q 1.5.1CommonJS
- react-native 0.87.1CommonJS
- morgan 1.12.0CommonJS
- ts-loader 9.6.2CommonJS
- webpack-dev-server 6.0.0Dual
- del 8.0.1ESM-only