I've downloaded the three.js from it's official site and I'm try to run very basic file, I'm getting weird error but when I replace the three.js file import with CDN it starts to work. Please help me in starting the file from local.
<html>
<head>
<title>1 - First Scene</title>
<link rel = "stylesheet" href = "Style.css">
<!-- <script src = "../three.js-master/src/Three.js"></script>--> <!-- This doesn't work, I get errors -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r83/three.min.js"></script> <!-- This works -->
</head>
<body>
</body>
</html>
<script >
let scene, camera, renderer;
// set up the environment -
// initiallize scene, camera, objects and renderer
let init = function() {
// create the scene
scene = new THREE.Scene();
scene.background = new THREE.Color(0xababab);
// create an locate the camera
camera = new THREE.PerspectiveCamera(30,
window.innerWidth / window.innerHeight,
1, 1000);
camera.position.z = 5;
// create the renderer
renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
};
// main animation loop - calls 50-60 in a second.
let mainLoop = function() {
console.log("Hello");
renderer.render(scene, camera);
requestAnimationFrame(mainLoop);
};
///////////////////////////////////////////////
init();
mainLoop();
</script>