0

I have created a simple model. Also converted that into gltf/glb. That model is showing up on babylon and as well as on three js. But whenever I am trying to import into my html file, error is showing up like,

"GLTFLoader.js:149 SyntaxError: Unexpected token < in JSON at position 0"

Note that, I am using Parcel Bundler for bundling.

const loader = new GLTFLoader();

loader.load("model.glb", function (gltf) {
  car = gltf.scene.children[0];
  car.scale.set(0.5, 0.5, 0.5);
  scene.add(gltf.scene);
  animate();
});

loader instance is successfully loaded. But the load method is not working. Please help me out.

  • Likely a duplicate of https://discourse.threejs.org/t/gltfloader-with-an-instance-of-dracoloader-is-giving-error/19327 and https://discourse.threejs.org/t/syntaxerror-unexpected-token-in-json-at-position-0/13810. – Mugen87 May 11 '21 at 07:58
  • 1
    Thanks mate, It was the problem of http server. I'd use Apache then . That solved my problem. – Md F A Sadik May 11 '21 at 16:49

1 Answers1

0

Thanks mate, It was the problem of http server. I'd use Apache then . That solved my problem.