I want to load .glb models using ThreeJS as done here, I'm using webpack v5 bundler, and I have changed the code from the upper link to adapt to the new imports:
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
import BasePlate from "../assets/glb/BasePlate_16x16.glb";
import Lego_2x2 from "../assets/glb/Lego_2x2.glb";
import Lego_2x4 from "../assets/glb/Lego_2x4.glb";
...
const parrotPosition = new Vector3(0, 0, 2.5);
loader.load(
BasePlate,
gltf => onLoad(gltf, parrotPosition),
onProgress
);
const flamingoPosition = new Vector3(7.5, 0, -10);
loader.load(
Lego_2x2,
gltf => onLoad(gltf, flamingoPosition),
onProgress
);
const storkPosition = new Vector3(0, -2.5, -10);
loader.load(
Lego_2x4,
gltf => onLoad(gltf, storkPosition),
onProgress
);
}
...
Now when I try to load the models I get the error:
Uncaught (in promise) TypeError: clipObject is undefined
You can find the models, the source code, and the config files here. The js code is here.