Skip to main content

using modules

In the previous tutorial we learned how to setup a basic three.js project but from now on we will be adding more and more code to the project. This will make it harder to keep track of everything and it will also make it harder to reuse code in other projects. To solve this problem we will be using modules to organize our code.

Modules

A module is a piece of code that can be reused in other projects. It can be a function, a class or a whole library. We already used modules in the previous tutorial when we imported the three.js library. But now we will be creating our own modules.