Good day.
I’m in the lesson - https://threejs.org/docs/#manual/en/introduction/Loading-3D-models. Stumble into the problem here when loading the model. Error in GLTFLoader.
My code:
import * as THREE from 'three';
import {GLTFLoader} from 'three/examples/jsm/loaders/GLTFLoader';
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000);
var renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.getElementById('main_site').appendChild(renderer.domElement);
var loader = new THREE.GLTFLoader();
loader.load('models/model.gltf', function (gltf) {
scene.add(gltf.scene);
}, undefined, function (error) {
console.error(error);
});
Place of error: new THREE.GLTFLoader();
Errors webpack: "export ‘GLTFLoader’ (imported as ‘THREE’) was not found in ‘three’
Error browser: TypeError: WEBPACK_IMPORTED_MODULE_0_three.GLTFLoader is not a constructor