babel-plugin-import-demand
v0.1.5
Published
babel plugin for load project demand
Downloads
23
Readme
babel-plugin-import-demand
Example
Converts
import { Button, DatePicker } from 'projectName';
(roughly) to
var _button = require('projectName/lib/button');
var _button2 = _interopRequireDefault(_button);
require('projectName/lib/button/style/css');
var _date_picker = require('projectName/lib/date-picker');
var _date_picker2 = _interopRequireDefault(_date_picker);
require('projectName/lib/date-picker/style/css');
Usage
npm install babel-plugin-import-demand --save-dev
Via .babelrc
or babel-loader.
{
"plugins": [["import-demand", options]]
}
options
options
can be object.
For Example:
{
"libName": "antd",
"libPath": "lib", // default: lib
"spell": true, // default: false
"cssPath": "style/css", // default: undefined
}
options
can be an array.
For Example:
[
{
"libName": "project",
"libPath": "dist", // default: lib
},
{
"libName": "antd",
"libPath": "lib",
"spell": true,
"cssPath": "style"
}
]
Note
babel-plugin-import-demand will be not working if you add the library in webpack config vender