For modern JavaScript projects using build tools, you can install Babylon.js via npm:

npm install @babylonjs/core @babylonjs/loaders --save

Import the entire library for easier development experience:

The @babylonjs/* scoped packages are the recommended modern approach, offering ES modules with full tree-shaking support. For development environments, using the global import provides convenience with access to all APIs without needing to add imports for each component.

// Import everything - larger bundle size but simpler development
import * as BABYLON from '@babylonjs/core';
import '@babylonjs/loaders';

Import only the specific components you need to minimize bundle size. This approach is recommended for production as it can significantly reduce final bundle size.

// Import only required components (recommended for production)
import { Engine, Scene, FreeCamera, Vector3, HemisphericLight, MeshBuilder } from '@babylonjs/core';
import '@babylonjs/loaders/glTF';