# scripts loaded twice

**URL:** <https://discourse.threejs.org/t/scripts-loaded-twice/83305>\
**Category:** Questions\
**Tags:** gltf-loader, threejs\
**Created:** [May 29, 2025, 12:48pm UTC](https://discourse.threejs.org/t/scripts-loaded-twice/83305 "2025-05-29T12:48:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![becket113](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/becket113/32/55490_2.png) [@becket113](https://discourse.threejs.org/u/becket113)\
**Post date:** [May 29, 2025, 12:48pm UTC](https://discourse.threejs.org/t/scripts-loaded-twice/83305/1 "2025-05-29T12:48:36Z")

</div>

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

my js file:

```javascript
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';

```

 ![f79eca237ef33a58befe50d16c4c643d](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/2/a/2a6ba107f4e1249e09d3bcd2d7413cfb4bbab328.png)

---

<div class="post-metadata">

**Author:** ![Chaser\_Code](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/chaser_code/32/20199_2.png) [@Chaser\_Code](https://discourse.threejs.org/u/Chaser_Code)\
**Post date:** [May 29, 2025, 12:58pm UTC](https://discourse.threejs.org/t/scripts-loaded-twice/83305/2 "2025-05-29T12:58:12Z")

</div>

Yes. cdn files contain path to other files. That is why cdn file is 0.6kb  
If you want you can change to real path:  
`import * as THREE from "https://cdn.skypack.dev/three@0.129.0/build/three.module.js";`  
to  
`import * as THREE from "https://cdn.skypack.dev/-/three@v0.129.0-XYKMzgCzb23GRdwfqj2I/dist=es2020,mode=imports,min/optimized/three.js";`

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/2/f/2f00934db3ca1325bd9eff80f0b0d58e9a011f72.png)

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [May 29, 2025, 1:56pm UTC](https://discourse.threejs.org/t/scripts-loaded-twice/83305/3 "2025-05-29T13:56:33Z")

</div>

In this case it’s a Skypack-specific redirect to a “pinned” build, so your browser should not actually be downloading full files twice. See:

> **[Pinned URLs (Optimized) | Skypack Docs](https://docs.skypack.dev/skypack-cdn/api-reference/pinned-urls-optimized)**

If things were configured wrong (for example loading three.js from one CDN, but then GLTFLoader — which depends on three.js — from a different CDN) you might have full duplicates loaded, and that is problematic. Using a bundler or an import map are the recommended ways to avoid that, but careful management of the CDN URLs should also work.

---

<div class="post-metadata">

**Author:** ![Lawrence3DPK](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/lawrence3dpk/32/29184_2.png) [@Lawrence3DPK](https://discourse.threejs.org/u/Lawrence3DPK)\
**Post date:** [May 29, 2025, 2:04pm UTC](https://discourse.threejs.org/t/scripts-loaded-twice/83305/4 "2025-05-29T14:04:01Z")

</div>

> [@becket113](#):
>
> ```javascript
> import {GUI} from 'https://cdn.skypack.dev/three@0.136.0/examples/jsm/libs/lil-gui.module.min.js';
> 
> ```

You can also try switching this to 0.129.0 to align with your other imports…

---

<div class="post-metadata">

**Author:** ![manthrax](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/manthrax/32/2596_2.png) [@manthrax](https://discourse.threejs.org/u/manthrax)\
**Post date:** [May 30, 2025, 1:08am UTC](https://discourse.threejs.org/t/scripts-loaded-twice/83305/5 "2025-05-30T01:08:37Z")

</div>

> [@becket113](#):
>
> ```javascript
> 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';
> 
> ```

Instead of this:

```javascript
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';

```

Do this:

```javascript
import * as THREE from "three";
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import {GLTFLoader} from "three/addons/loaders/GLTFLoader.js";
import {GUI} from 'three/addons/libs/lil-gui.module.min.js';

```

and add this importmap script to the beginning of your html (before other scripts)

```javascript
<script type="importmap">
        {
            "imports": {
                "three": "https://cdn.skypack.dev/three@0.136.0/build/three.module.js",
                "three/addons/": "https://cdn.skypack.dev/three@0.136.0/examples/jsm/"
            }
        }
</script>

```

---

<div class="post-metadata">

**Author:** ![becket113](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/becket113/32/55490_2.png) [@becket113](https://discourse.threejs.org/u/becket113)\
**Post date:** [May 31, 2025, 10:33am UTC](https://discourse.threejs.org/t/scripts-loaded-twice/83305/6 "2025-05-31T10:33:07Z")

</div>

thanks good man, may God will protect you from evil !
