Three useful Babel presets

By Axel Rauschmayer

As of version 6, Babel supports presets, sets of features that can be enabled together. Two new presets are useful complements to babel-preset-es2015 (for ES6):

  • babel-preset-es2016 gives you the two features of ECMAScript 2016: the exponentiation operator and Array.prototype.includes().
  • babel-preset-es2017 gives you:
    • babel-plugin-syntax-trailing-function-commas: optional trailing commas in parameter lists and function/method calls.
    • babel-plugin-transform-async-to-generator: async functions. This is the one feature after ES6 that I’m most looking forward to.

The following preset is a replacement for babel-preset-es2015 on Node.js:

  • babel-preset-es2015-node only adds those ES6 plugins and transforms whose functionality is missing from Node.js (very few in the latest versions).

More information:

Source:: 2ality