@babel/plugin-transform-jscript
Example
In
var foo = function bar() {};
Out
"use strict";
var foo = (function() {
function bar() {}
return bar;
})();
Installation
npm install --save-dev @babel/plugin-transform-jscript
Usage
With a configuration file (Recommended)
{
"plugins": ["@babel/plugin-transform-jscript"]
}
Via CLI
babel --plugins @babel/plugin-transform-jscript script.js
Via Node API
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-transform-jscript"],
});