babel-plugin-import-to-global

1.0.1 • Public • Published

English | 简体中文

babel-plugin-import-to-global

traverse import to global expression

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;

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-import-to-global

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

2.5 kB

Total Files

4

Last publish

Collaborators

  • ~likun