canirequire › Dual (CommonJS + ESM) › three
Is three ESM-only? Can you require() it?
JavaScript 3D library
Last verified Sep 9, 2026 against three@0.186.0. JSON
Dual (CommonJS + ESM) Dual package — both require() and import work
three publishes both a CommonJS entry and a native ESM entry (ESM added in 0.137.0). require("three") and import "three" both work on every supported Node.js version and in Bun.
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 | ✓ works | ✓ works |
A failing require() on a CommonJS package usually means the package needs a browser/DOM global, a peer dependency, or a native binary that is not available in a bare Node.js process.
How to import three
ES modules (import)
import three from "three";CommonJS (require)
const three = require("three");Module format by version
Derived from the type, main and exports fields of every stable release on npm (299 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 0.144.0 – 0.186.0 | Dual (CommonJS + ESM) | Aug 31, 2022 |
Frequently asked
Is three ESM-only?
three@0.186.0 ships CommonJS and ESM builds. three publishes both a CommonJS entry and a native ESM entry (ESM added in 0.137.0). require("three") and import "three" both work on every supported Node.js version and in Bun.
Can I require three?
Yes. three ships a CommonJS entry, so require("three") works on every Node.js version, alongside the native ESM entry for import.
Does three work in Bun?
Yes. import "three" loaded successfully in Bun 1.4 on Sep 9, 2026.
Does three ship TypeScript types?
Not bundled. Install the community types with "npm install -D @types/three".
Links
Other dual (commonjs + esm) packages
- minimatch 10.2.6Dual
- brace-expansion 5.0.9Dual
- lru-cache 11.5.2Dual
- glob 13.0.6Dual
- eslint-visitor-keys 5.0.1Dual
- yallist 5.0.0Dual
- balanced-match 4.0.4Dual
- js-yaml 5.4.1Dual
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
- graphql-tag 2.12.7CommonJS
- mocha 12.0.0ESM-only