Simon R.
Simon R.

Reputation: 151

How do I install Three.js?

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?

Upvotes: 2

Views: 3293

Answers (4)

Arjun S
Arjun S

Reputation: 11

Hello there might be a little late to answer this but if you want to include this in your projects then please use the three.min.js since it is a compressed version of the main library and if you are using any modeuls please add the modules lib as well as of the the time i am answering this the folder structure is very diffrent and now youn can easily install using node or cdn but in this you just can add the three.min.js file and assuming you are using plain html and css

<script src="thee.min.js" type="module"></script>
<script src="three.js"></script> // for the scene create yourself

You can add this just before closing the body tag

<body>
//enter the script hear
</body>

Upvotes: 1

Shashank Agrawal
Shashank Agrawal

Reputation: 25807

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

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

Upvotes: 0

Riccardo Bertolini
Riccardo Bertolini

Reputation: 166

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/[email protected]/build/three.js"></script>

and that's it! :)

Upvotes: 3

gaitat
gaitat

Reputation: 12642

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/[email protected]/build/three.js https://cdn.jsdelivr.net/npm/[email protected]/build/three.min.js https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js and download the already built version.

Upvotes: 0

Related Questions