babel-plugin-transform-global-window
v1.0.2
Published
Transforms previously module scoped variables into globally scoped window properties
Downloads
17
Maintainers
Readme
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;