babel-plugin-import-to-global
v1.0.1
Published
traverse import to global declaration
Downloads
3
Readme
English | 简体中文
install
npm i -D babel-plugin-import-to-global
// or
yarn add -D babel-plugin-import-to-global
config
.babelrc
{
plugins: ['babel-plugin-import-to-global', {
moduleName: 'A', // moudule name
globalName: 'window', // global var name(default window)
globalAttr: 'a' // global attr name(default moduleName)
}]
}
example
import AM from "A";
output:
const AM = window.a;