Skip to content

droidxrx/babel-plugin-transform-global-window

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Babel plugin transform global window

Transforms previously module scoped variables into globally scoped window properties

Installation

This is a Node.js module available through the npm registry.

npm install --save-dev babel-plugin-transform-global-window
yarn add --dev babel-plugin-transform-global-window

Usage

Add to .babelrc

{
    "plugins": ["babel-plugin-transform-global-window"]
}

Input

const myvar1 = "MyVar1";
let myvar2 = "MyVar2";
const arrfun = () => 1 + 1;
function myFun() {
    return 1 + 1;
}
class myClass {}

Output

const myvar1 = "MyVar1";
let myvar2 = "MyVar2";

const arrfun = () => 1 + 1;

function myFun() {
    return 1 + 1;
}

class myClass {}

window.myvar1 = myvar1;
window.myvar2 = myvar2;
window.arrfun = arrfun;
window.myFun = myFun;
window.myClass = myClass;

License

MIT

About

Transforms previously module scoped variables into globally scoped window properties

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published