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. Markdown · 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 with a plain require()-able CommonJS entry is 3.7.1, published Aug 28, 2023.
require("jquery") 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("jquery") fails with ERR_REQUIRE_ESM.
What to do
- require("jquery") 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 jquery = await import("jquery"). That works on every Node.js version the package supports.
- If you need a synchronous require() or run Node.js 18: npm install jquery@3.7.1, the last CommonJS release (published Aug 28, 2023).
- TypeScript: npm install -D @types/jquery
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 | ✗ failsError |
| Node.js 20 | ✗ failsError | ✗ failsError |
| Node.js 22 | ✗ failsError | ✗ failsError |
| Node.js 24 | ✗ failsError | ✗ failsError |
| Node.js 26 | ✗ failsError | ✗ failsError |
| Bun 1.4.0 | ✗ failsError | ✗ failsError |
How to import jquery
ES modules (import)
import * as jquery from "jquery";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
// require("jquery") failed in our probe on Node.js 20.19+, 22.12+ and newer as well (jQuery requires a window with a document); see the runtime table.
// Any Node.js version the package supports, from an async function:
async function main() {
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, corrected where a runtime test of that version contradicted them (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 with a plain require()-able CommonJS entry 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?
From a CommonJS file, use a dynamic import inside an async function: const jquery = await import("jquery"). That works on every Node.js version the package supports. require("jquery") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. Alternatively pin jquery@3.7.1.
Does jquery work in Bun?
Importing jquery failed in Bun 1.4.0 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 - 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
- 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