In
eval("(() => 'foo')");
Out
eval("(function () { return 'foo'; })");
npm install --save-dev babel-plugin-transform-eval
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-eval"]
}
babel --plugins transform-eval script.js
require("babel-core").transform("code", {
plugins: ["transform-eval"]
});