light-babel-import
v1.6.8
Published
Modular build plugin for babel.
Downloads
2
Readme
babel-plugin-import
一个轻量的按需加载库
Install
npm install light-babel-import --save-dev
Example
Converts
import { _isUrl } from 'light-utils'
to
var _isUrl = require('light-utils/lib/_isUrl')
styleLibraryName Example
Converts
import Components from 'components'
import { Button } from 'components'
to
require('components/lib/styleLibraryName/index.css')
var button = require('components/lib/styleLibraryName/button.css')
Usage
Via .babelrc
or babel-loader.
{
"plugins": [["light-babel-import", options]]
}
Multiple Module
{
"plugins": [xxx,
["light-babel-import", {
libraryName: "antd",
style: true,
}, "antd"],
["light-babel-import", {
libraryName: "test-module",
style: true,
}, "test-module"]
]
}