New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-demand

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-demand

按需加载babel插件

1.0.1
Source
npm
Version published
Maintainers
1
Created
Source

#babel-plugin-demand

用于公共 js 库按需加载的babel插件

NPM version Build Status

Install

npm i babel-plugin-demand -D

Usage

.babelrc 或者 babel-loader 文件中配置

{
  "plugins": [
    [
      "demand", {
        packageName: 'xx-sdk',
        redirect: 'lib'
        // ...options
      }
    ]
  ]
}

Example

import { foo } from 'xx-sdk'
foo()

上述代码会被转为

import _foo from 'xx-sdk/lib/foo'
_foo()

options

参数名称含义类型是否必填默认值
packageNamejs 包的名字String
redirect函数所在的目录String'lib'
camel2Dash驼峰文件名是否需要转为 '-' 连接Booleanfalse

Keywords

babel

FAQs

Package last updated on 22 Nov 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