canirequire

canirequire › ESM-only › three

Is three ESM-only? Can you require() it?

JavaScript 3D library

Last verified Sep 9, 2026 against three@0.186.0. Markdown · JSON

ESM-only ESM-only since 0.186.0 — last CommonJS version is 0.185.1

three dropped its CommonJS build in 0.186.0 (September 2026). The last version with a plain require()-able CommonJS entry is 0.185.1, published Jul 1, 2026.

On Node.js 20.19+, 22.12+ and newer, require("three") works with the latest version: Node.js loads synchronous ES modules through require(). Verified on Node.js 20, 22, 24 and 26. On Node.js 18, which has no require(esm), require("three") fails with ERR_REQUIRE_ESM.

What to do

  1. On Node.js 20.19+, 22.12+ and newer, require("three") works with the latest version: Node.js loads synchronous ES modules through require(). Verified on Node.js 20, 22, 24 and 26.
  2. From a CommonJS file, use a dynamic import inside an async function: const three = await import("three"). That works on every Node.js version the package supports.
  3. If you need a synchronous require() or run Node.js 18: npm install three@0.185.1, the last CommonJS release (published Jul 1, 2026).
  4. TypeScript: npm install -D @types/three
Latest
0.186.0 (Sep 8, 2026)
Module format
ESM-only
Last CommonJS version
0.185.1
ESM-only since
0.186.0 (Sep 8, 2026)
TypeScript types
@types/three
Node engines
not declared
Weekly downloads
14.0M
License
MIT

Does three@0.186.0 actually load? Runtime test results

Installed and executed on Sep 9, 2026 with require("three") from a CommonJS file and import "three" from an ES module.

Runtimerequire("three")import "three"
Node.js 18✗ failsERR_REQUIRE_ESM✓ works
Node.js 20✓ works✓ works
Node.js 22✓ works✓ works
Node.js 24✓ works✓ works
Node.js 26✓ works✓ works
Bun 1.4.0✓ works✓ works

How to import three

ES modules (import)

import * as three from "three";

Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.

CommonJS (require)

// Node.js 20.19+, 22.12+ and newer (verified):
const three = require("three");

// Any Node.js version the package supports, from an async function:
async function main() {
  const three = await import("three");
}

// Or pin the last CommonJS release:
// npm install three@0.185.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 (299 versions; the newest 60 shown).

VersionsFormatFirst published
0.186.0ESM-onlySep 8, 2026
0.144.0 – 0.185.1Dual (CommonJS + ESM)Aug 31, 2022

Frequently asked

Is three ESM-only?

three@0.186.0 is ESM-only. three dropped its CommonJS build in 0.186.0 (September 2026). The last version with a plain require()-able CommonJS entry is 0.185.1, published Jul 1, 2026.

Which version of three still supports CommonJS / require()?

0.185.1 is the last version of three with a CommonJS build. Install it with "npm install three@0.185.1". Every version from 0.186.0 on is ESM-only.

How do I use three from a CommonJS file?

From a CommonJS file, use a dynamic import inside an async function: const three = await import("three"). That works on every Node.js version the package supports. On Node.js 20.19+, 22.12+ and newer, require("three") works with the latest version: Node.js loads synchronous ES modules through require(). Verified on Node.js 20, 22, 24 and 26. Alternatively pin three@0.185.1.

Does three work in Bun?

Yes. import "three" loaded successfully in Bun 1.4.0 on Sep 9, 2026.

Does three ship TypeScript types?

Not bundled. Install the community types with "npm install -D @types/three".

Links

Other esm-only packages

Similar popularity