I've updated to latest babel v6. However I noticed that using transform-es2015-classes
plugin with loose mode on (https://github.com/bkonkle/babel-preset-es2015-loose/blob/master/index.js#L8) breaks async/await functions. For example:
function _asyncFunc (value) {
return new Promise((resolve) => {
setTimeout(() => resolve(value), 10);
});
}
class TestActions {
async asyncAction(returnValue) {
const result = await _asyncFunc(returnValue); // exception here
return result;
}
}
Breaks with loose on this line:
var result = await _asyncFunc(returnValue);
^^^^^^^^^^
SyntaxError: Unexpected identifier
Babelrc looks as follows (also I'm using regenerator runtime by importing it in entry point import 'babel-runtime/regenerator/runtime';
):
{
"presets": [
"es2015-loose",
"react",
"stage-0"
]
}
I need to use loose mode because of this Babel bug - https://phabricator.babeljs.io/T3041
Any workarounds?