Sorry for posting this as I have already seen a few others that are very similar. But I just can’t figure it out. I am unable to load models whatsoever after several days of trying.
For example, I found this playground link here in the forum:
But when I try to run it locally, I get the importMesh error.
The only thing that I am doing differently is using the module imports (and webpack to build).
I am able to get the demo app with the cylinder working using module imports and webpack, but I cannot load any models.
import { Engine, SceneLoader, Scene } from '@babylonjs/core';
function main() {
const canvas = document.getElementById('renderCanvas');
const opts = { preserveDrawingBuffer: true, stencil: true };
const engine = new Engine(canvas, true, opts);
let scene = new Scene(engine);
SceneLoader.ImportMesh(
'',
'https://playground.babylonjs.com/scenes/',
'BoomBox.glb',
scene,
(meshes) => {
scene.createDefaultCameraOrLight(true, true, true);
scene.createDefaultEnvironment();
console.log(meshes);
},
);
}
main();
Any suggestions? Thanks!