1.0.0 • Published 6 years ago

babel-plugin-import-separation v1.0.0

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

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]]
}