Can't find threejs and threejs.min.js file

aftre last update, I can’t find threejs and threejs.min.js files inside build folder. any one can descriibe me details about file name changing and how can I use now within html file. please help me.

These files are gone since Three.js r161:

3 Likes

Now we’ve switched to using “import” to load libraries and components.

Put this script tag in your HTML BEFORE any other scripts:

<script type="importmap">
{
    "imports": {
        "three": "https://threejs.org/build/three.module.js",
        "three/addons/": "https://threejs.org/examples/jsm/"
    }
}</script>

Load your own script after like:

<script type="module" src="./YourMainScript.js"></script>

(notice the type = ‘module’ means you can now use “import” in your scripts)

Then in YourMainScript.js:
use:

import *as THREE from "three"
import {OrbitControls} from "three/addons/controls/OrbitControls.js"

To load the different things.

With this setup, now you can change where you are pulling threejs and its components, just by changing the importmap. It’s a more flexible mechanism and keeps most of the code interaction in the .js files instead of woven through the html.

2 Likes

awesome, thanks, it’s working perfectly for me.

1 Like