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


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

查看所有标签

猜你喜欢:

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

Pro HTML5 Programming

Pro HTML5 Programming

Peter Lubbers、Brian Albers、Frank Salim / Apress / 2010-9-1 / USD 49.99

HTML5 is here, and with it, web applications take on a power, ease, scalability, and responsiveness like never before. In this book, developers will learn how to use the latest cutting-edge HTML5 web ......一起来看看 《Pro HTML5 Programming》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具