@babel/plugin-transform-function-name
info
This plugin is included in @babel/preset-env
Examples
In
JavaScript
let number = x => x;
Out
JavaScript
var number = function number(x) {
return x;
};
Installation
- npm
- Yarn
- pnpm
npm install --save-dev @babel/plugin-transform-function-name
yarn add --dev @babel/plugin-transform-function-name
pnpm add --save-dev @babel/plugin-transform-function-name
Usage
With a configuration file (Recommended)
babel.config.json
{
"plugins": ["@babel/plugin-transform-function-name"]
}
Via CLI
Shell
babel --plugins @babel/plugin-transform-function-name script.js
Via Node API
JavaScript
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-transform-function-name"],
});