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-7-1 / CNY 55.00

在当今互联网时代,我们的隐私权已经受到了威胁,政府或企业可以追踪我们的电话,搜索引擎可以记录我们的在线浏览记录以及恒温器的设置以及更多信息。在当代,保卫隐私权不只是简单地描述出存在的问题或者警告人们隐私权已经丧失,隐私权的护卫者们提出了解决策略。他们密切关注商业实践、公共政策和技术设计以及人物,应该继续下去吗?条件就是:有问题,让我们找到解决之道。一起来看看 《无处安放的互联网隐私》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

随机密码生成器
随机密码生成器

多种字符组合密码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码