We're using async/await for our Meteor project. This syntax is everywhere in our resolvers.js. Everything has been working fine until we've upgraded to Node 6.7. Now it shows this error every time we try to build it:
"The keyword 'await' is reserved (53:24)"
Does anyone know how to solve this?
Here is the content of my .babelrc file:
{
"presets": ["es2015", "stage-2", "react"],
"plugins": ["react-require", "babel-root-slash-import"]
}
Just in case anyone else searches for this same issue, in my case it was user error, me. I forgot to put the async keyword before the function name.
Okay, I found out a solution to my own problem. I just excluded the .babelrc when doing a Meteor build since Meteor already has a package that supports ES6 syntax. I didn't totally remove the .babelrc because I will be needing it on tests and when running the Storybook which does not trigger a Meteor build.
Await alone is invalid syntax. await needs to be called inside an async function like:
var aFunction = async function() {
let aResponse = await get('aValue');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With