canirequire

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

  1. require("jquery") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it.
  2. 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.
  3. 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).
  4. TypeScript: npm install -D @types/jquery
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✗ 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.1

Module 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).

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

Similar popularity