babel-plugin-import-separation

1.0.0 • Public • Published

babel-plugin-import-separation

a plugin for babel to load on demand from import.


Where to add babel-plugin-import

Example

{ "libraryName": "antd" }

import { Button } from 'antd';
ReactDOM.render(<Button>xxxx</Button>);
 
      ↓ ↓ ↓ ↓ ↓ ↓
 
import Button from 'antd/lib/button';
ReactDOM.render(<Button>xxxx</Button>);

{ "libraryName": "antd", style: true }

import { Button } from 'antd';
ReactDOM.render(<Button>xxxx</Button>);
 
      ↓ ↓ ↓ ↓ ↓ ↓
 
import 'antd/lib/button/style';
import Button from 'antd/lib/button';
ReactDOM.render(<_button>xxxx</_button>);

Usage

npm install babel-plugin-import-separation --save-dev

Via .babelrc or babel-loader.

{
  "plugins": [["import", options]]
}

Package Sidebar

Install

npm i babel-plugin-import-separation

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

6.58 kB

Total Files

4

Last publish

Collaborators

  • hazyzh