@babel/plugin-transform-block-scoped-functions
NOTE: This plugin is included in
@babel/preset-env
Examples
In
{
function name(n) {
return n;
}
}
name("Steve");
Out
{
let name = function(n) {
return n;
};
}
name("Steve");
Installation
npm install --save-dev @babel/plugin-transform-block-scoped-functions
Usage
With a configuration file (Recommended)
{
"plugins": ["@babel/plugin-transform-block-scoped-functions"]
}
Via CLI
babel --plugins @babel/plugin-transform-block-scoped-functions script.js
Via Node API
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-transform-block-scoped-functions"],
});