This plugin allows Babel to transform named function expressions into function declarations to get around some particularly nasty JScript bugs related to name function expressions.
GitHub · npm · Edit this page
See particularly nasty JScript bugs.
In
var foo = function bar() {
};
Out
"use strict";
var foo = (function () {
function bar() {}
return bar;
})();
npm install --save-dev babel-plugin-transform-jscript
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-jscript"]
}
babel --plugins transform-jscript script.js
require("babel-core").transform("code", {
plugins: ["transform-jscript"]
});