babel-plugin-javascript
v1.0.0
Published
Import all your globals as ES6 modules
Downloads
9
Maintainers
Readme
babel-plugin-javascript
This plugin will allow you to import all globals using js modules. Thanks to that you will stop using non-explicit variables.
Example
In
import JavaScript from 'javascript';
import { Object } from 'javascript';
import Math from 'javascript/Math';
import { abs } from 'javascript/Math';
JavaScript.window;
new Object();
Math.round();
abs();
Out
self.window;
new self.Object();
self.Math.round();
self.Math.abs();
Installation
$ npm install babel-plugin-javascript
Usage
Via .babelrc
(Recommended)
.babelrc
{
"plugins": ["javascript"]
}
Via CLI
$ babel --plugins javascript script.js
Via Node API
require("@babel/core").transform("code", {
plugins: ["javascript"]
});