GLTFLoader not working with three.module.js

I just started using three js and I was trying to switch to modules but the gltf loader doesn’t work. I even tried using examples I found on the main site but I can’t make them work. This is the code, very simple because I was trying to understand what didn’t work exactly, and it turns out it’s the loader section, everything else works if I comment it out

            body {
                margin: 0;
                overflow: hidden;
        <script type="module">
            import * as THREE from './build/three.module.js';
            import { GLTFLoader } from './jsm/loaders/GLTFLoader.js';
            import { OrbitControls } from './jsm/controls/OrbitControls.js';

            let camera,

            renderer = new THREE.WebGLRenderer({antialias:true});
            renderer.setSize(window.innerWidth, window.innerHeight);

        camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 10000;
            var controls = new OrbitControls(camera, renderer.domElement);

            scene = new THREE.Scene();

            var light = new THREE.AmbientLight(0xffffff, 1);

            var material = new THREE.MeshBasicMaterial({color: 0x77cc77});
            var geometry = new THREE.BoxGeometry();

            var cube = new THREE.Mesh(geometry, material);

            const loader = new GLTFLoader();
            loader.load('./cube.glb', function ( gltf ) {
                const mesh = scene.children[0];
            } );

            //RENDER LOOP

            function render() {
                renderer.render(scene, camera);

The cube.glb object is literally the default Blender cube I exported after getting rid of the light and the camera. I also tried to take its geometry and paint it like the other cube, and also to change the background to white to make sure it wasn’t just blending in with the background, still nothing

I managed to load models, merge them etc with three.js, that’s why I feel like it’s due to modules, unless I’m missing something

  1. Make sure there are no errors in the console.
  2. After adding the model to the scene (in load callback) do:
  1. If still not visible, make sure the model is not too small / too big. You can try mesh.add(new THREE.Mesh(new THREE.BoxBufferGeometry(1.0, 1.0, 1.0), new THREE.MeshNormalMaterial)) - if you can see the cube, but can’t see the model - scale is probably the issue.

I can’t load the same models I loaded in my three.js files, so I don’t think it’s a problem of the models themselves, I’ll check tomorrow

I think you should:
const loader = new GLTFLoader();
loader.load(’./cube.glb’, function ( gltf ) {
// gltf.scene.scale.set(x, y, z); to set position
// gltf.scene.position.set(x, y, z); to set sclale
gltf.scene.traverse(function (child) {
if (child.isMesh) {
//do something with mesh.
child.castShadow = true;

Thanks, it was a silly mistake, I forgot gltf. before scene