title: Uncaught SyntaxError: Cannot use import statement outside a module
body: <p><a href="https://www.youtube.com/watch?v=1TeMXIWRrqE" rel="nofollow noreferrer">https://www.youtube.com/watch?v=1TeMXIWRrqE</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
   &lt;title&gt;Three.js&lt;/title&gt;
   &lt;style type="text/css"&gt;
    html, body {margin: 0; padding: 0; overflow: hidden}
   &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div id="webgl"&gt;&lt;/div&gt;
   &lt;script src="three.js"&gt;&lt;/script&gt;
      &lt;script src="GLTFLoader.js"&gt;&lt;/script&gt;
   &lt;script&gt;
          
      let scene,camera,renderer;
      function init(){
      scene = new THREE.Scene();
      scene.background = new THREE.Color(0xdddddd);
      
      camera = new THREE.PerspectiveCamera(40,window.innerWidth/window.innerHeight,1,5000);
      
      hlight = new THREE.AmbientLight(0x404040,100);
      scene.add(hlight);
      
      renderer = new THREE.WebGLRenderer({antialias:true});
      renderer.setSize(window.innerWidth,window.innerHeight);
      document.getElementById('webgl').appendChild(renderer.domElement);
      
      let loader = new THREE.GLTFLoader();  //THE ERROR WITH THIS, I TRIED WITHOUT THREE. ONLY GLTLOADER() BUT DID NOT WORK 
      loader.load('scene.gltf', function(gltf){
          scene.add(gltf.scene);
          renderer.render(scene,camera);
      });
  }
  init();
      &lt;/script&gt;
        
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  
  <a href="https://sketchfab.com/3d-models/1972-datsun-240k-gt-non-commercial-use-only-b2303a552b444e5b8637fdf5169b41cb" rel="nofollow noreferrer">https://sketchfab.com/3d-models/1972-datsun-240k-gt-non-commercial-use-only-b2303a552b444e5b8637fdf5169b41cb</a>
  //<a href="https://www.youtube.com/watch?v=1TeMXIWRrqE" rel="nofollow noreferrer">https://www.youtube.com/watch?v=1TeMXIWRrqE</a>
   This is tutorial for GLTFLOADER , i imported same 3d file as well and written same code, but when i open the file on local server, i get 2 errors in console: 
  1) "GLTFLoader.js:9 Uncaught SyntaxError: Cannot use import statement outside a module"
  2) "(index):29 Uncaught TypeError: THREE.GLTFLoader is not a constructor."
           Although in youtube video it opens with him immediatly!! :(
  I would be greatful if anybody can hep me out with this. THANK YOU SO MUCH</p>
  
  <p>GLTFLoader.js:9 Uncaught SyntaxError
  <a href="https://i.stack.imgur.com/apJnn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/apJnn.jpg" alt="GLTFLoader.js:9 Uncaught SyntaxError"></a></p>
  
  <p>(index):29 Uncaught TypeError
  <a href="https://i.stack.imgur.com/sa1xp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sa1xp.jpg" alt="(index):29 Uncaught TypeError"></a></p>