Create external gltf loader to manage project

Hello friends! how can i optimize my multiple lines function in main.js into functions like mygltfloader(path); addlight(type, position) or events listener in some external js files? I want to make my project easier to manage.
Anyway i’m using vite, how build the project with multiple js file?
Thanks for reading my situation.

I have developed a vanilla js library (three.ez) to simplify development, including asset management, by using the ‘Asset’ class to preload and caching assets.

Example (using multiple files):


If you are only interested in using the class, and not the package, you can find it here.

If you use react, I recommend using r3f

1 Like