# errorify

> Browserify plugin to write failed build error messages to the output file

Latest version **0.3.1** (published 2015-08-06) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2015-08-06 |
| First published | 2014-09-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 75 |
| Author | Andres Suarez |
| Maintainers | zertosh, mattdesl |
| Keywords | build, browserify, browserify-plugin |

## Links

- npm: https://www.npmjs.com/package/errorify
- Repository: https://github.com/zertosh/errorify
- Issues: https://github.com/zertosh/errorify/issues
- npm.io page: https://npm.io/package/errorify

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.3.1 (latest) — 2015-08-06
- 0.3.0 — 2015-08-03
- 0.2.4 — 2015-04-11
- 0.2.3 — 2015-04-10
- 0.2.2 — 2015-04-09
- 0.2.1 — 2015-04-07
- 0.2.0 — 2015-03-23
- 0.1.0 — 2015-03-23
- 0.0.2 — 2015-03-21
- 0.0.1 — 2014-09-28

## README

# errorify

A [browserify](https://github.com/substack/node-browserify) plugin that writes the error message of a failed build to the output file, rendering it in the browser.

[![Build Status](https://travis-ci.org/zertosh/errorify.svg?branch=master&style=flat)](https://travis-ci.org/zertosh/errorify)

## Example

```sh
watchify index.js -o bundle.js -p errorify
```

After adding the plugin to your `browserify` instance, `errorify` prevents `bundle()` from emitting `error`'s. All errors are trapped, including: invalid syntax in the source, a missing dependency, a failed transform, etc. When the error message is written to the output file, it is written to the DOM in a `<pre>` tag (or `console.error` if we are not in a browser environment). 

During development, it might look like this: 

![es6](http://i.imgur.com/Pen6bYu.png)

Only the `bundle()` stream is rewritten. If you pass in a callback, it'll get the expected `err` and `body` arguments.

`errorify` is meant to be used with something like [watchify](https://github.com/substack/watchify). It saves you a trip to the terminal to see why a build failed.

Keep in mind that since errors are no longer emitted, all builds appear "successful". Careful not to deploy broken code.

_Note: Only tested with Browserify 9+_

## Usage

### API

```js
var browserify = require('browserify');
var errorify = require('errorify');
var b = browserify({ /*...*/ });
b.plugin(errorify, /* errorify options */);
```

#### Options

* `replacer` _(optional)_ is a function that takes an error as its first argument, and returns a string that will be used as the output bundle.

### CLI

After installing `errorify` as a local devDependency, you can use the `--plugin` or `-p` option like so:

```sh
watchify index.js -o bundle.js -p errorify
```

### CSS Customization

The added `<pre>` tag has the class name `errorify`, so you can customize errors in your page like so:

```css
body > .errorify {
  color: red;
  font-family: 'Consolas', monospace;
  padding: 5px 10px;
}
```

## License

MIT.

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