🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

babel-plugin-cc-import-lib

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-cc-import-lib

a babel plugin to import lib --cc

latest
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

简单实现对象的结构

  • 在.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';

Keywords

babel

FAQs

Package last updated on 29 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts