3D Model TS Library (Rollup)
raw JSON → 1.3.6 verified Mon Apr 27 auth: no javascript
A TypeScript library for 3D model loading and rendering using rollup as the bundler. The latest version is 1.3.6. It provides a simple API to initialize with a key and supports loading 3D models. Includes TypeScript type definitions. The release cadence is unknown but updates are infrequent. Key differentiators: simple API, integrated with rollup for bundling, and supports both ESM and CJS via unpkg CDN.
Common errors
error Cannot find module '3d-model-ts-library-rollup' ↓
cause The package is not installed or is not in node_modules.
fix
Run 'npm install 3d-model-ts-library-rollup' to install the package.
error initKey is not a function ↓
cause Using CommonJS require instead of ESM import.
fix
Use 'import { initKey } from '3d-model-ts-library-rollup'' instead of require.
Warnings
breaking initKey must be called before any other function; otherwise, API calls will fail. ↓
fix Ensure initKey is called at the very beginning of your application.
deprecated The cjs bundle is deprecated in favor of esm. ↓
fix Switch to using the esm build via import instead of require.
gotcha The CDN script tag uses a specific version; using older versions may cause compatibility issues. ↓
fix Always use the latest version or specify a version explicitly.
Install
npm install 3d-model-ts-library-rollup yarn add 3d-model-ts-library-rollup pnpm add 3d-model-ts-library-rollup Imports
- initKey wrong
const initKey = require('3d-model-ts-library-rollup')correctimport { initKey } from '3d-model-ts-library-rollup' - default (library) wrong
import * as Lib from '3d-model-ts-library-rollup'correctimport Lib from '3d-model-ts-library-rollup' - loadModel
import { loadModel } from '3d-model-ts-library-rollup'
Quickstart
import { initKey, loadModel } from '3d-model-ts-library-rollup';
// Initialize with your API key
initKey(process.env.API_KEY ?? 'YOUR_KEY_HERE');
// Load a 3D model
const model = await loadModel('https://example.com/model.glb');
console.log('Model loaded:', model);