1.0.1 • Published 10 years ago
babel-plugin-transform-assign-top-level-to-global v1.0.1
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-globalUsage
Via .babelrc (Recommended)
.babelrc
{
"plugins": ["transform-assign-top-level-to-global"]
}Via CLI
$ babel --plugins transform-assign-top-level-to-global script.jsVia Node API
require("babel-core").transform("code", {
plugins: ["transform-assign-top-level-to-global"]
});1.0.1
10 years ago