The only thing I officially couldn’t write using ES6 syntax/Babel is Yeoman generator. Even it’s not something I write too often, this limitation is quite annoying when you actually write it. Here’s the workaround I came up with.
generators/*
folder with any name, but not index.js
. I usually call it index.es6
..babelrc
etc.).That’s it. You can use your generator written in ES6.
Use class
syntax to create your Yeoman generator:
constructor
instead of initializing
method to attach your stuff to the instance.getters
to define generator properties.Here is an example of generator written in ES6 and published as npm module: generator-react-sandbox-server