scripts loaded twice

Instead of this:

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:

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)

<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>
4 Likes