I am trying for hours but can not import and use three.js

same as this: Orbit Controls - Install with cdn - #2 by drcmda

  1. install node
  2. type “npm create vite”, name your project, select “vanilla”
  3. cd into your project
  4. run “npm install three”
  5. run “npm run dev”

run the commands, you are set up under 10 seconds. keep in mind that browser esm is unfinished. building import maps, servers to run it, file watchers that refresh the site on save, something that compresses and builds it so you can publish, etc — no sense in doing this by hand.

1 Like