Whenever I try importing a blender model in the file I get this error:Error loading model: SyntaxError: Unexpected token ‘<’, "<!DOCTYPE "… is not valid JSON
The part of the code I use is:
import { GLTFLoader } from ‘three/examples/jsm/loaders/GLTFLoader’;
const loader = new GLTFLoader();
loader.load(“asteroid.glb”, (gltf) => {
asteroid = gltf.scene;
scene.add(asteroid);
console.log(“Asteroid model loaded:”, asteroid);
}, undefined, (error) => {
console.error(“Error loading model:”, error);
});
I use parcel to run project on a local server. The asteroid.glb file is in a public folder. I also tried putting a ‘/’ before the path but no use.
I have no idea what to do right now