Skip to main content

@babel/plugin-transform-jscript

Example

In

JavaScript
var foo = function bar() {};

Out

JavaScript
"use strict";

var foo = (function() {
function bar() {}

return bar;
})();

Installation

npm install --save-dev @babel/plugin-transform-jscript

Usage

babel.config.json
{
"plugins": ["@babel/plugin-transform-jscript"]
}

Via CLI

Shell
babel --plugins @babel/plugin-transform-jscript script.js

Via Node API

JavaScript
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-transform-jscript"],
});