2

I want to work with Three.js and I would like to download it, but when I click "download", on the Three.js-Website, I get a folder with a lot of stuff in it: enter image description here From looking at this folder structure, I'm guessing I'll only need to include three.js, or three.min.js, which, I'm guessing is the same, only with less code, no tabs…

Is this correct, do I only need the: three.js-file, for Three.js to work? …and what is the three.module.js-file for?

Simon R.
  • 151
  • 10
  • 1
    Keep in mind that textures and other loaded assets won't load if you're accessing your site directly on your hard-drive through `file:///...` due to safety protocols. You'll need to run a local server [as recommended here](https://threejs.org/docs/#manual/en/introduction/How-to-run-things-locally) – M - Jan 25 '21 at 19:49
  • Does this answer your question? [What is the URL for three.js to include it online?](https://stackoverflow.com/questions/23434732/what-is-the-url-for-three-js-to-include-it-online) – Shashank Agrawal Mar 07 '22 at 08:29

3 Answers3

3

Not sure where you want to use it, but if it's for web development, do the following: open the page you're looking for, and just before the tag </body> add

<script src="https://cdn.jsdelivr.net/npm/three@0.124.0/build/three.js"></script>

and that's it! :)

  • 1
    Thank You, for your answer! I want to use it for web-development, but I would like to download it, so that I can work on stuff, while offline. I just linked the `three.js` file to my index and that worked. :) – Simon R. Jan 25 '21 at 08:07
  • As a side note, you can of course remove the URL, then fill between the brackets with the contents of the actual file. highly useful when you have a IoT device that is so resource constrained it can really only host a single html file. EG. ESP8266/ESP32, etc etc. – Charlie Mar 03 '23 at 23:08
0

Yes, what you have downloaded is the entire project in source format. Then you would need to build it in order to create the three.js libraries. If you want to download the libraries (without building the source code) you can go to https://cdn.jsdelivr.net/npm/three@0.124.0/build/three.js https://cdn.jsdelivr.net/npm/three@0.124.0/build/three.min.js https://cdn.jsdelivr.net/npm/three@0.124.0/build/three.module.js and download the already built version.

gaitat
  • 12,449
  • 4
  • 52
  • 76
  • 1
    “Then you would need to build it” while I think you’re correct that the download includes the source, the question shows and mentions the pre-built files in the build/ directory. – stealththeninja Jan 24 '21 at 20:29
  • Thank You, for your answer! …but what does: "build it" mean? …also I think I don't have to do that, the files in the build-folder look identical to what you have linked to. – Simon R. Jan 25 '21 at 08:03
0

If you are not using the ES6 module or any build tools like Webpack, refer to this answer-

https://stackoverflow.com/a/71377614/2405040.

Shashank Agrawal
  • 25,161
  • 11
  • 89
  • 121