DEALING WITH DIFFERENT three.js VERSIONS, WITHOUT THE PAIN
Semver? No Way!
The development pace of three.js is fast, and it uses a slightly unusual versioning system. Most software gets released incrementally as V0.5, V0.6, V1.0, V1.1.1 etc. This is known as Semantic Versioning, or semver for short.
Well, three.js is far too hipster for that - instead, we use a revision system, with names like R45, R67, R98 etc. There’s a new revision out once a month or so. You can view a change log of recent releases here.
Syntax in Older Versions
The syntax may change in any revision. This means that if you are following a tutorial or book that was written a couple of years ago when R65 was the bee’s knees, you may find that things are not working out as you expect.
In practice, it’s not actually that bad. The majority of the syntax has not changed in years. Also, everything that does change is kept as an alias if possible. Whenever you use one of these aliases, a deprecation warning is logged to the console but your app will still work just fine.
For example, here we are being told that the improperly named old
AxisHelper has been renamed to the correct
AxesHelper. The old name will still work, but we’ll get this warning every time we use it.
So if you are following an old tutorial or getting help from a three year old StackOverflow post that has out of date syntax, most things will still work. Just make sure to keep an eye on those console warnings (remember, press
CTRL + SHIFT + I, or
CMD + SHIFT + I on Mac to view these).
Always Use Examples and Plugins that Match Your three.js Version
While the syntax is relatively static, behind the scenes the code may have changed a lot between releases.
You should make sure that any files you use from the /examples folder match the version of three.js you are using, otherwise, you might run into some nasty and hard to pin down bugs.
If in doubt, download the latest release as a zip file here and use the files from that.
Watch These Pages for Changes
To keep up to date with changes, follow these pages: