Wednesday, 7 June 2017

How to transform ES2017 to ES5

I have a es2017 code with async/await, I want to transform it to es5 so that it'll be supported by most Node.js versions.

My current .babelrc file looks like this:

{
    "presets": ["es2015", "es2016", "es2017"]
}

So I'm transforming es2017 to es2016, from es2016 to es2015 and from es2015 to es5.

When I'm trying to run the code after I built it with babel src -d dist -s I'm getting error saying that: ReferenceError: regeneratorRuntime is not defined

How can I transform the es2017 code to es5? I wanna publish the code later and make it usable by node.js v4 and up.



via xerq

No comments:

Post a Comment