Three useful Babel presets
As of version 6, Babel supports presets, sets of features that can be enabled together. This blog post looks at three new useful Babel presets (and, as a bonus, two presets especially for Node.js).
Complementing or replacing
These two presets are useful complements to
babel-preset-es2015 (for ES6):
Note that if you want all of ES2017 (as much as it is supported by Babel) then you need three presets:
es2017. Alternatively, there is also a meta-preset:
babel-preset-latest will always contain all the “yearly” presets. At the moment, those are:
Bonus: minimal presets for Node.js
babel-preset-es2015. It checks the Node.js version and only enables plugins whose functionality is missing (not much in recent versions).
babel-preset-latest. It determines what plugins are needed via feature detection. As the repository’s readme states: that only makes sense for Node.js, but not for browsers.