Builderz: Zero Configuration JavaScript Bundler

栏目: IT技术 · 发布时间: 4年前

内容简介:In yourOr even:

Builderz

Zero Configuration JavaScript Bundler

build/er/z is built originally to bundle monorepos, expanded later to cover more build cases with a wide variety of options. It implements rollup, taking advantage of its simplicity and customization to build one-step production bundler.

Install

npm install builderz

Easy to use

"build": "builderz"

Easy to customize

In your packages.json to compile to a CommonJS module (cjs) and minify the bundle just pass the required arguments.

"build": "builderz --formats=cjs --minify"

Or even:

"scripts": {
   "build":"...",
   "test": "..."
},
"builderz":{
   "formats": ["cjs"],
   "minify": true,
}

Of course you cane import it as build package somewhere in your project:

const builderz = require("builderz");

// Multi-word options are camel-cased. Pass list as array.
const options = {};

builderz(options);

Options

-s, --silent <boolean>       Silent mode, mutes build massages (default: true)
  -f, --formats <list>         Specific build format (default: [])
  -m, --minify <boolean>       Minify bundle works only if format is provided (default: false)
  -m, --sourcemap <boolean>    Enable sourcemap in output
  -c, --camel-case <boolean>   Add camel-cased output file (default: true)
  -l, --clean-build <boolean>  Clean previous build folder (default: false)
  -b, --build-name <string>    Specific folder build name (default: "dist")
  -o, --output <string>        Custom output name
  -w, --pkg-paths <list>       Provide custom paths not in the root/src (default: [])
  -n, --pkg-names <list>       Building specific package[s], in workspace (default: [])
  -a, --alias <list>           Package Alias (default: [])
  -e, --entries <list>         Add multi entries instead of default src/index. (default: [])
  -r, --banner <string>        Add banner to output
  -d, --es-module <string>     Define Property exports (default: false)
  -t, --strict <string>        Enable Strict Mode (default: false)
  -h, --help                   display help for command

Under the hood

It does multiple things to save you some time and lets you focus on developing, that includes:

  1. Gets all validate packages by path or even names, by looking into the workplace for monorepo and root directory for one single package.

  2. Extract JSON from each package found in the workplace. To get essential production information.

  3. Cleans build folders if required.

  4. Creates camelize output name, bundles according to given name or just leaves it as it is with the original name in package.json

  5. If monorepo, sorts packages according to core/dependency , so core comes first and so on.

  6. Validates entries and aut-detect if src/entry or ./entry

  7. Creates a distension path for each project found.

  8. If there's no targeted format, it generates default formats (CJS, UMD, ES) one cycle minified with a map and the second is not.

  9. Highly customized. Reads local package build args first, resolves local paths. Prioritize local args to global ones.

Test

npm test

Related projects

License

This project is licensed under the GPL-3.0 License


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

颠覆者:周鸿祎自传

颠覆者:周鸿祎自传

周鸿祎、范海涛 / 北京联合出版公司 / 2017-11 / 49.80元

周鸿祎,一个在中国互联网历史上举足轻重的名字。他被认为是奠定当今中国互联网格局的人之一。 作为第一代互联网人,中国互联网行业最好的产品经理、创业者,他每时每刻都以自己的实践,为互联网的发展贡献自己的力量。 在很长一段时间内,他没有在公共场合发声,甚至有粉丝对当前死水一潭的互联网现状不满意,发出了“人民想念周鸿祎”的呼声。 但周鸿祎在小时候,却是一个踢天弄井,动不动就大闹天宫的超级......一起来看看 《颠覆者:周鸿祎自传》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具