three.js is a powerful, lightweight, cross-browser JavaScript library for creating and displaying animated 3D graphics in a web browser using WebGL, WebGPU, and other renderers. It abstracts away the complexities of low-level graphics APIs, providing a high-level scene graph, cameras, lights, materials, and geometries. The library is actively maintained with frequent minor releases (currently at 0.184.0), typically on a monthly cadence, focusing on performance, new features, and the removal of deprecated APIs. Its key differentiators include a vast ecosystem of examples, extensive documentation, and a strong community, making it a go-to choice for interactive 3D web experiences, virtual reality, and augmented reality applications.
npm install threeVerified import paths — ran on the pinned version, not inferred.
This code initializes a basic 3D scene with a rotating cube, a perspective camera, and a WebGL renderer, animating it in the browser.
Always check the official 'Migration Guide' for your target version before upgrading. Update code to use current APIs and practices.
Use ES module syntax: `import * as THREE from 'three';`. Ensure your build environment (e.g., Webpack, Rollup, Vite) is configured to handle ESM or use an older version if CommonJS is strictly required without a bundler.
Configure your bundler (e.g., Webpack's `resolve.extensions`, `module.rules`) to handle `.js` extensions correctly for imported modules, or explicitly include the `.js` extension in import paths: `import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';`.Always export/import scenes with the same or newer `three.js` version. Be prepared to update saved scene files if you downgrade or if the format changes significantly between major upgrades.
Ensure you are using `import * as THREE from 'three';` for modern ES module environments or that the `three.js` script is loaded *before* your application script in a browser environment using `<script src="three.min.js"></script>`.
Explicitly include the `.js` extension in your import statement: `import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';`No dependency data recorded yet.