three.js require('three') prints "[THREE_CJS_DEPRECATED] DeprecationWarning: `require(\"three\")` is deprecated and will be removed"
@shreyanshsaurabh01▲ -1 net votes
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.