1.0.1 • Published 4 years ago

babel-plugin-import-to-global v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

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;