I have been upgrading my project to use ES7. I have changed some codes, made use of classes.
But there is a problem.
class Example {
change = async (params) => {
const job = await Some.job();
}
}
Everytime I wanted to debug it gives me Unexpected token problem. Even if I run it with Babel, it fails. I know a project where people use this kind of syntax and it works. I could not a valid solution on the internet, a couple github issues but nothing solid, so asking here. What is the problem here? How should I setup the Babel or the project? Below the error from the console and my config file screenshots.
Just check out this link. Installing Babel V6.x ES7 Async/Await on Node.js v6.2.0 with Nodemon (You can also check this if you want to install plugin: https://babeljs.io/docs/plugins/transform-async-to-generator/ )
Alternatively search Google "babel async await support" and see the results.
Babel does not give you whole things supported out of the box, you have to make some configurations, installing presets/plugins etc.
In my situation I needed to install stage-0 preset and/or transform plugins to make sure async keywords are supported. In the link above it says stage-3 but you can install stage-0 also, it includes all the plugins up to stage-3.
Babel needs to be documented much better, there is no way you could just get to documentation and set things up. There is not a straight one way Getting started a Project setup that shows you things in an ordered way. Hope they woul add it.