New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

miniprogram-build-npm

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

miniprogram-build-npm

miniprogram build npm

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

miniprogram-build-npm

小程序npm支持的改进版。

Why?

开发者工具自带的【构建 npm】不支持tree-shaking, 拿redux@3.6.0为例,v3.6.0redux引入了lodash/isPlainObject, 结果构建npm后整个lodash都被构建进了miniprogram_npm。此库就是为了解决此问题。

Usage

$ yarn add miniprogram-build-npm -D
{
  "scripts": {
    "build-npm": "miniprogram-build-npm"
  }
}
$ npm run build-npm

Options

--output/-o

Type: string Default: miniprogram_npm

构建输出路径

$ miniprogram-build-npm --output libs

--format/-f

Type: cjs | esm Default: cjs

输出模块格式:

  • cjs - CommonJS
  • esm - ES, 使用此格式可以配合【ES6转ES5】使用

具体输出格式需要看引入的包支持不支持相关格式,如果包本身发布时只发布了es5的格式,那么即使指定esm也无效,会原样打包

$ miniprogram-build-npm --format esm

--sourcemap/-s

Type: boolean Default: false

开启sourcemap

$ miniprogram-build-npm --sourcemap

API

除了作为命令行使用,还可以使用api调用

const build = require('miniprogram-build-npm');

build({
  output: 'libs',
  format: 'esm',
  sourcemap: false,
});

Keywords

miniprogram

FAQs

Package last updated on 10 Dec 2020

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