Three js files loaded twice

is this normal thing ? In devtools its shows that files loaded twice

my js file:

import * as THREE from "https://cdn.skypack.dev/three@0.129.0/build/three.module.js";
import { OrbitControls } from 'https://cdn.skypack.dev/three@0.129.0/examples/jsm/controls/OrbitControls.js';
import {GLTFLoader} from "https://cdn.skypack.dev/three@0.129.0/examples/jsm/loaders/GLTFLoader.js";
import {GUI} from 'https://cdn.skypack.dev/three@0.136.0/examples/jsm/libs/lil-gui.module.min.js';
   loader.load(
        '/d3dcont/FB180-21.glb',
        function (glb) {

            object = glb.scene;
           
            object.traverse((chi)=>{
                if(chi.isMesh){
                    
                   
                    if(chi.name=="Text001_1"){
                        //chi.visible=false;
                        chi.material.color.setHex(0x000000);
                    }
                    else{
                    chi.castShadow=true;
                    chi.receiveShadow=true;
                    }
                }
            });
            glb.scene.position.y = 0;
            glb.scene.rotation.y=5;
            
            scene.add(object);
            

            isObjloader = true;
            
            progCont.classList.remove('loading-state');
            progCont.style.display = 'none';

           
        },
        function (xhr) {

            progValue.innerHTML = Math.round(xhr.loaded / xhr.total * 100);
            progbar.value = Math.round(xhr.loaded / xhr.total * 100);

        },
        function (error) {
            console.error(error);
        }
    );

Yes. cdn files contain path to other files and loading it.

Not sure asking the same question twice will solve it…

Change this…

To this…

https://cdn.skypack.dev/three@0.129.0/examples/jsm/libs/lil-gui.module.min.js

As @donmccurdy pointed out in the previous post, you’re better off using an import map over direct imports from cdn…

2 Likes

Although this has been marked as solved the true solution has been given by @manthrax here…

2 Likes