Importing Three.js as Module
When updating older Threejs projects, you may get a warning in the browser such as,
“As part of the transition to ES6 Modules, the files in ‘examples/js’ were deprecated in May 2020 (r117) and will be deleted in December 2020 (r124).”
There are several steps involved in converting your Threejs projects to use modules, and In this article I will show you a very quick and simple way of handling this problem.
The steps I will show are,
- Create the basic project
- Install Three
- Create the basic NodeJS server
- Create the client HTML and JavaScript
- Create the start script
- Start it and see it running in the browser
This will be a simple Three.js example that uses Module Specifiers in the client.
The code demonstrated in this article can also be found at my official GitHub page at https://github.com/Sean-Bradley/Threejs-Boilerplate
Create the basic project
Create a working folder on your computer somewhere. eg, mkdir myproject