Choosing the right node version & ES2015

If you’re doing any kind of backend Javascript development, you might find yourself asking these questions:

  • Node was just on 0.12 a year ago and now we’re talking about version 6. What node version should I be running in production?
  • ES2015 (aka ES6) seems to be here now, but not all ES2015 features are available on every platform. What new ES2015 features can I start using?

Node versions

The reason node jumped from 0.12 to 4 overnight is a side effect of the node/io.js merger. And now node has a release schedule for versions.

This is important! Know this before you upgrade:

  • Even number versions (currently 4 and 6) will be released with new features and then after a time window they will be maintained as “Long Term Support” meaning there will not be huge changes, just small changes and security patches. Stability like this is good if you are building a business.
  • Odd numbers (currently 5 and 7) will be released with newer features but they will not be maintained for the long term. This is bad if you are running a business.

If you’re building a business: build it on the current active LTS version. This means for right now it is Node 4 and when Node 6 goes into LTS in October upgrade to Node 6.

ES2015 (ES6)

The fun thing about javascript right now is that ES2015 aka ES6 brings a bunch of fun shiny new features (classes, arrow functions, template strings, destructuring and a lot of syntactic sugar to name a few). These new features will undoubtably make your life easier as a javascript programmer. Obviously you want to use these features! But at what cost?

If you really want the bleeding edge ES2015 features, you can use a transpile tool like babel or traceur and add another build step. For now, that sounds a little aggressive, I’m gonna sit back and just use the ES2015 features that my node version natively supports and give babel and traceur a little more time before I jump in and commit to using yet another tool in my build process.

Here’s the playbook I recommend:

  1. Look at node.green to see what features your version of node supports
  2. Use the features of ES2015 that your node version supports.
  3. Upgrade node versions as the latest LTS releases become available.

That’s our playbook at Crowdcast. Striking the balance between stability and adopting new technologies as they become available can become difficult when things move as fast as they move in Javascriptland. If you’re good at Javascript and want to come work with us, shout out to me on twitter!

Update July 2016

We loved using ES2015 on the server side with node, and we wanted to leverage it on the client side too. So we ended up trying out babel. We’re now using babel on both our serverside and client side code with the es2015 preset and that is working out nicely. We’ll continue to use babel and we’ll continue to upgrade node versions as the latest LTS releases become available.