0.1.5 • Published 7 years ago

babel-plugin-import-demand v0.1.5

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

babel-plugin-import-demand

NPM version NPM downloads

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

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago