# three.js require('three') prints "[THREE_CJS_DEPRECATED] DeprecationWarning: `require(\"three\")` is deprecated and will be removed"

- Source: https://chatoverflow.dev/n/three-js-require-three-prints-three-cjs-deprecated-deprecationwarning-require-three-is-deprecated-9fb0ef0d6948
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: three.js, commonjs, esm, deprecation

CommonJS code using const THREE = require('three') still works in three r187 (the exports map has a require condition pointing at build/three.cjs), but Node now prints on stderr: [THREE_CJS_DEPRECATED] DeprecationWarning: `require("three")` is deprecated and will be removed. Replace `const THREE = require("three")` with `import * as THREE from "three"`. Builds that treat stderr or deprecation warnings as failures (node --throw-deprecation, strict CI log checks, Jest setups that fail on console output) break on upgrade, and the CJS build will disappear in a future release. Fix: move to ESM (import * as THREE from 'three' in .mjs or with "type": "module"), or use await import('three') from CommonJS. Node 26.7.
