# bundleify

> Bundle your JS with browserify with preconfigured transforms

Latest version **1.6.0** (published 2017-02-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install bundleify
pnpm add bundleify
yarn add bundleify
bun add bundleify
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.6.0 |
| Published | 2017-02-08 |
| First published | 2016-05-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 13 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Ben Drucker |
| Maintainers | bendrucker |
| Keywords | browserify, bundle, eaze, transform, uglify, source, maps, defaults, stream |

## Links

- npm: https://www.npmjs.com/package/bundleify
- Repository: https://github.com/bendrucker/bundleify
- Homepage: https://github.com/bendrucker/bundleify#readme
- Issues: https://github.com/bendrucker/bundleify/issues
- npm.io page: https://npm.io/package/bundleify

## Dependencies (13)

- [ap](https://npm.io/package/ap.md) ~0.2.0
- [flat](https://npm.io/package/flat.md) ~2.0.0
- [xtend](https://npm.io/package/xtend.md) ~4.0.1
- [envify](https://npm.io/package/envify.md) ~3.4.0
- [es2020](https://npm.io/package/es2020.md) ~1.1.2
- [exorcist](https://npm.io/package/exorcist.md) ~0.4.0
- [map-keys](https://npm.io/package/map-keys.md) ~1.0.0
- [through2](https://npm.io/package/through2.md) ~2.0.1
- [uglifyify](https://npm.io/package/uglifyify.md) ~3.0.1
- [browserify](https://npm.io/package/browserify.md) ~13.0.0
- [value-pipe](https://npm.io/package/value-pipe.md) ~1.0.0
- [readable-stream](https://npm.io/package/readable-stream.md) ~2.1.2
- [bundle-collapser](https://npm.io/package/bundle-collapser.md) ~1.2.1

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.6.0 (latest) — 2017-02-08
- 1.5.0 — 2016-09-26
- 1.4.1 — 2016-05-29
- 1.4.0 — 2016-05-27
- 1.3.5 — 2016-05-19
- 1.3.4 — 2016-05-12
- 1.3.3 — 2016-05-10
- 1.3.2 — 2016-05-10
- 1.3.1 — 2016-05-10
- 1.3.0 — 2016-05-10
- 1.2.0 — 2016-05-10
- 1.1.2 — 2016-05-05
- 1.1.1 — 2016-05-05
- 1.1.0 — 2016-05-05
- 1.0.1 — 2016-05-04
- … 1 more at https://npm.io/package/bundleify/versions

## README

# bundleify [![Build Status](https://travis-ci.org/bendrucker/bundleify.svg?branch=master)](https://travis-ci.org/bendrucker/bundleify)

> Bundle your JS with browserify with preconfigured transforms


## Install

```
$ npm install --save bundleify
```


## Usage

```js
var bundleify = require('bundleify')

bundleify({
  entry: 'app.js',
  destination: 'build' 
}, function (err) {
  //=> wrote build to `./build`  
})
```

bundleify applies the following settings and transforms:

* [es2020](https://github.com/yoshuawuyts/es2020), a transpiler for a tiny subset of ES6
* source maps
* exposes your entry as `require('app')`
* flattens configuration and uses it to replace environment variables
* applies minification transforms when in compression mode:
  * [uglifyify](https://github.com/hughsk/uglifyify)
  * [bundle-collapser](https://www.npmjs.com/package/bundle-collapser)
  * extracts source map to an external file
  * re-compresses with [uglify](https://github.com/mishoo/UglifyJS2) for more byte savings

### Transforms

Browserify transforms applied to the bundle are not [global](https://github.com/substack/node-browserify#btransformtr-opts) by default, but *uglifyify* and *es2020* are explicitly run globally. That means the following features are limited to your code and do not run on your dependencies:

* Environment variable replacement

## API

#### `bundleify(options, callback)` -> `undefined`

##### options

*Required*  
Type: `object`

###### entry

*Required*  
Type: `string`

The relative path to the entry file.

###### destination

*Required*  
Type: `string`

The relative path to the destination folder.

###### basedir

Type: `string`  
Default: `process.cwd()`

The base directory from which the entry and destination paths are resolved.

###### compress

Type: `boolean`  
Default: `false`

Toggles minification/compression transforms (see *Usage*).

###### config

Type: `object`  
Default: `{}`

Nested configuration to be transformed into environment variables that will be replaced in the bundle. Given the following config:

```js
{
  foo: {
    bar: 'baz'
  }
}
```

You can write the following code:

```js
console.log(process.env.FOO_BAR)
//=> baz
```

Any environment variables that are not explicit defined in the configuration will be set to `undefined`.

###### filename

Type: `string`  
Default: `bundle.js`

The destination filename.

##### callback

*Required*  
Type: `function`  
Arguments: `err`

A callback that will be called with a build error if applicable, otherwise `null`.


## License

MIT © [Ben Drucker](http://bendrucker.me)

---
_Source: https://npm.io/package/bundleify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
