0.0.2 • Published 6 years ago

babel-plugin-auto-import-jweboy v0.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

babel-plugin-auto-import-jweboy

babel模块化导入插件,实现了按需加载的功能来满足常规业务需求。

Useage

npm install babel-plugin-auto-import-jweboy --save-dev

yarn add babel-plugin-auto-import-jweboy --dev

在.babelrc增加配置

{
    "plugins": ["auto-import-jweboy", options]
}

Options

options是一个对象类型

模块化导入js

{
    "libraryName": "test-ui"
}

模块化按需导入js、css

{
    "libraryName": "test-ui",
    "style": true
}

Example

{ "libraryName": "test-ui" }
Before compiling:
import { Button } from 'test-ui'

After compilation:
var _Button = _interopRequireDefault(require("test-ui/lib/Button"));
{ "libraryName": "test-ui", "style": true }
Before compiling:
import { Button } from 'test-ui'

After compilation:
require("test-ui/lib/Button/style");
var _Button = _interopRequireDefault(require("test-ui/lib/Button"));
0.0.2

6 years ago

0.0.1

6 years ago