1.1.1 • Published 6 years ago

babel-plugin-cc-import-lib v1.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

简单实现对象的结构

  • 在.babelrc或者package.json中进行配置,libraryName为需要按需加载的库
  • 如果需要引入样式,则增加style字段

通过 .babelrc or babel-loader 增加配置

{
  "plugins": [["cc-import-lib", options]]
}

options

options 是一个对象.

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

##For Example:

{
  ...

  "plugins": [
    ...
    
    ["cc-import-lib", {
      "libraryName": "lodash",
      "style": true
    }]
  ]
}

##转换

import { clone, copy } from 'lodash';

      ↓ ↓ ↓ ↓ ↓ ↓

import clone from 'lodash/clone';
import 'lodash/clone/style';
import copy from 'lodash/copy';
import 'lodash/copy/style';