# broccoli-watchify

> Watchify plugin for Broccoli.

Latest version **2.0.0** (published 2019-04-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install broccoli-watchify
pnpm add broccoli-watchify
yarn add broccoli-watchify
bun add broccoli-watchify
```

## 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 | 2.0.0 |
| Published | 2019-04-01 |
| First published | 2014-11-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | 8.* \|\| >= 10.* |
| Dependencies | 12 |
| Unpacked size | 127.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Andrey Subbotin & Stefan Penner |
| Maintainers | eploko, stefanpenner |
| Keywords | broccoli, broccoli-plugin, plugin, watchify, browserify, caching, cache, incremental, bundle |

## Links

- npm: https://www.npmjs.com/package/broccoli-watchify
- Repository: https://github.com/eploko/broccoli-watchify
- Issues: https://github.com/eploko/broccoli-watchify/issues
- npm.io page: https://npm.io/package/broccoli-watchify

## Dependencies (12)

- [rsvp](https://npm.io/package/rsvp.md) ^4.8.4
- [xtend](https://npm.io/package/xtend.md) ^4.0.1
- [md5hex](https://npm.io/package/md5hex.md) ^1.0.0
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^7.0.1
- [through2](https://npm.io/package/through2.md) ^3.0.1
- [tree-sync](https://npm.io/package/tree-sync.md) ^2.0.0
- [browserify](https://npm.io/package/browserify.md) ^16.2.3
- [broccoli-plugin](https://npm.io/package/broccoli-plugin.md) ^1.3.1
- [lodash.assignin](https://npm.io/package/lodash.assignin.md) ^4.2.0
- [symlink-or-copy](https://npm.io/package/symlink-or-copy.md) ^1.2.0
- [node-modules-path](https://npm.io/package/node-modules-path.md) ^1.0.2

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2019-04-01
- 1.0.1 — 2016-12-03
- 1.0.0 — 2016-09-12
- 0.2.0 — 2014-11-17
- 0.1.3 — 2014-11-16
- 0.1.2 — 2014-11-16
- 0.1.1 — 2014-11-16
- 0.1.0 — 2014-11-16

## README

# broccoli-watchify [![Build Status](https://travis-ci.org/eploko/broccoli-watchify.svg)](https://travis-ci.org/eploko/broccoli-watchify)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eploko/broccoli-watchify?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

The broccoli-watchify plugin bundles your assets with
[watchify](https://github.com/substack/watchify).

## Installation

```bash
npm install --save-dev broccoli-watchify
```

## Example

```js
const watchify = require('broccoli-watchify');

const options = {
  browserify: {
    entries: ['./app.js'],
    debug: true
  },
  nodeModulesPath: process.cwd() + '/node_modules', // provide the node_modules you want to resolve from
  outputFile: 'bundled/app.js',
  cache: true,
  init: function (b) {
    b.transform('reactify', {'es6': true});
    b.external('$');
  }
};

const tree = watchify(tree, options);
```

## API

### watchify(tree, options)

* `tree`: A [broccoli tree](https://github.com/broccolijs/broccoli#plugin-api-specification) or a directory path as a string

#### Options

* `browserify`: (defaults to `{}`) Options passed to the [browserify constructor](https://github.com/substack/node-browserify#var-b--browserifyfiles-or-opts)
* `outputFile`: (defaults to `"./browserify.js"`) Output file
* `cache`: (defaults to `true`) A boolean flag to potentially switch the caching off and act like a plain browserify. Can be helpful in assembling bundles for production and _not_ including all the full local path names in the bundle, which is not possible in the watchify mode.
* `init`: (defaults to a no-op) A callback function that receives the browserify instance after it's created. Use this to call any of the [browserify API methods](https://github.com/substack/node-browserify#methods) on the instance, including `add`, `require`, `external`, `exclude` and so on.
* `nodeModulesPath`: (defaults to `process.cwd()/node_modules`) Absolute path to node_modules.

## Changelog

### 2.0.0

* expose a way to configure which node_modules to resolve from
* support broccoli 1x and 2x
* modernize codebase
* upgrade dependencies

### 1.0.0

* No longer use watchify directly, as we do not require its watcher and it is not configurable. Rather we populate the cache, the same way watchify does.
* Stable output, so downstream plugins aren't invalidated if our output doesn't change.
* Much faster.
* Basic tests.
* Browserified files are browserified relative to the broccoli `inputPath`, not the realpath.

### 0.2.0

* Add the `init` option to provide a possibility of configuration of the browserify instance with a custom function.
* Remove the `entries` and `require` options.
* Add the `cache` option to turn off the watchify behavior and act like a plain browserify.

### 0.1.3

* Initial release

## Contributors

The code of this plugin is originally based on the [broccoli-browserify](https://github.com/gingerhendrix/broccoli-browserify) plugin by [Gareth Andrew](http://github.com/gingerhendrix).

## License

The MIT License (MIT). See [LICENSE](LICENSE) for details.

Copyright © 2014 Andrey Subbotin.

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