canirequire

canirequireESM-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.

Latest
4.0.0 (Jan 18, 2026)
Module format
ESM-only
Last CommonJS version
3.7.1
ESM-only since
4.0.0 (Jan 18, 2026)
TypeScript types
@types/jquery
Node engines
not declared
Weekly downloads
11.8M
License
MIT

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.

Runtimerequire("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.1

Module format by version

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

VersionsFormatFirst published
4.0.0ESM-onlyJan 18, 2026
1.5.1 – 3.7.1CommonJSMar 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

Similar popularity