While it may appear that this should be done by es2015-function-name, another way to think about it is that es2015-function-name implements the naming that javascript engines are supposed to do; and javascript engines cannot name function expressions that are the object of a member expression.
babel-plugin-transform-es2015-function-name
Apply ES2015 function.name semantics to all functions
Examples
In
let number = (x) => x
Out
var number = function number(x) {
return x;
};
Installation
npm install --save-dev babel-plugin-transform-es2015-function-name
Usage
Via .babelrc (Recommended)
.babelrc
{
"plugins": ["transform-es2015-function-name"]
}
Via CLI
babel --plugins transform-es2015-function-name script.js
Via Node API
require("babel-core").transform("code", {
plugins: ["transform-es2015-function-name"]
});