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


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

查看所有标签

猜你喜欢:

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

Head First Servlets & JSP(中文版)

Head First Servlets & JSP(中文版)

(美)巴萨姆、(美)塞若、(美)贝茨 / 苏钰函、林剑 / 中国电力出版社 / 2006-10 / 98.00元

《Head First Servlets·JSP》(中文版)结合SCWCD考试大纲讲述了关于如何编写servlets和JSP代码,如何使用JSP表达式语言,如何部署Web应用,如何开发定制标记,以及会话状态、包装器、过滤器、企业设计模式等方面的知识,以一种轻松、幽默而又形象的方式让你了解、掌握servlets和JSP,并将其运用到你的项目中去。《Head First Servlets·JSP》(中......一起来看看 《Head First Servlets & JSP(中文版)》 这本书的介绍吧!

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

在线压缩/解压 JS 代码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器