babel-plugin-transform-assign-top-level-to-global

Assign all top level variables to globals

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
babel-plugin-transform-assign-top-level-to-global
1.0.17 years ago7 years agoMinified + gzip package size for babel-plugin-transform-assign-top-level-to-global in KB

Readme

babel-plugin-transform-assign-top-level-to-global
This plugin transforms all top level declarations to global assignments.

Example

In
function foo() {}
let bar = "";

Out
function foo() {}
global.foo = foo;

let bar = "";
global.bar = bar;

Installation

$ npm install babel-plugin-transform-assign-top-level-to-global

Usage

Via .babelrc (Recommended)

.babelrc
{
  "plugins": ["transform-assign-top-level-to-global"]
}

Via CLI

$ babel --plugins transform-assign-top-level-to-global script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-assign-top-level-to-global"]
});