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
- 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.
- 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.
- 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).
- TypeScript: npm install -D @types/three
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.
| Runtime | require("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.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 (299 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 0.186.0 | ESM-only | Sep 8, 2026 |
| 0.144.0 – 0.185.1 | Dual (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
- 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
- postcss-safe-parser 7.1.0CommonJS
- react-i18next 17.0.13Dual
- raf 3.4.1CommonJS
- npmlog 7.0.1CommonJS
- npm 12.0.2CommonJS
- vue 3.5.42Dual
- @rollup/plugin-node-resolve 16.0.3Dual
- graphql-tag 2.12.7CommonJS