@babel/plugin-transform-jscript

Example

In

  1. var foo = function bar() {
  2. };

Out

  1. "use strict";
  2. var foo = (function () {
  3. function bar() {}
  4. return bar;
  5. })();

Installation

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

Usage

  1. {
  2. "plugins": ["@babel/plugin-transform-jscript"]
  3. }

Via CLI

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

Via Node API

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