Hi, I am getting “Failed to load module script:” error.
can you help me with this. Thanks in advance
My console
my code
import * as THREE from ‘./node_modules/three/build/three.module.js’
import Stats from ‘./node_modules/three/examples/jsm/libs/stats.module.js’
import {FBXLoader} from “./node_modules/three/examples/jsm/loaders/FBXLoader.js”;
var container, stats, controls;
var camera, scene, renderer, light;
var clock = new THREE.Clock();
var mixer;
init();
animate();
function init() {
container = document.createElement( 'div' );
document.body.appendChild( container );
camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
camera.position.set( 0, 220, 700 );
scene = new THREE.Scene();
scene.background = new THREE.Color( 0xffffff );
light = new THREE.HemisphereLight( 0xffffff, 0xa0a0a0 );
light.position.set( 0, 200, 0 );
scene.add( light );
var loader = new FBXLoader();
loader.load( './assets/js/models/1.fbx', function ( object ) {
mixer = new THREE.AnimationMixer( object );
object.rotation.x = 0.5;
object.rotation.y = -0.7;
var action = mixer.clipAction( object.animations[ 0 ] );
action.play();
object.traverse( function ( child ) {
if(child.name == "pil"){
child.material = new THREE.MeshPhongMaterial( {
color: 0xf86708,
wireframe: false,
} );
child.castShadow = false;
child.receiveShadow = false;
}else{
if ( child.isMesh ) {
child.material = new THREE.MeshPhongMaterial( {
color: 0xffffff,
wireframe: true,
} );
child.castShadow = true;
child.receiveShadow = true;
}
}
} );
document.addEventListener("mousemove", function(e){
let xC = e.pageX;
let xCalc = (xC / window.innerWidth);
object.rotation.y = -xCalc;
});
scene.add( object );
});
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.shadowMap.enabled = true;
container.appendChild( renderer.domElement );
window.addEventListener( 'resize', onWindowResize, false );
// stats
stats = new Stats();
container.appendChild( stats.dom );
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
}
function animate() {
requestAnimationFrame( animate );
var delta = clock.getDelta();
if ( mixer ) mixer.update( delta );
renderer.render( scene, camera );
stats.update();
}
</script>