even if you somehow make that work, threejs will soon delete /js and then you’ll scramble. especially as a beginner, you’re wasting your your time on script tags. the old ones are from a bygone era and very few things support them any longer, we’re using modules now. the esm script tags are not finished and will cause you never ending trouble. not to mention that CDNs can be unreliable.
webdev functions through node, npm and bundling. you are ready to go in seconds:
- install node
- type “npm create vite”, name your project, select “vanilla”
- cd into your project
- run “npm install three”
- run “npm run dev”
and that is it, open the url it gives you in the browser, open your editor, edit a file and save, it will be reflected in the browser. when you want to publish run “npm run build” and copy the dist folder onto your server, it will already be compressed and tree shaken (using only the parts you actually need).
if you want to use three:
import * as THREE from 'three'
import { OrbitControls } form 'three/examples/jsm/controls/OrbitControls'