Browserify plugin to write failed build error messages to the output file
npm install errorifyA browserify plugin that writes the error message of a failed build to the output file, rendering it in the browser.

``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
tag (orconsole.errorif we are not in a browser environment).bundle()During development, it might look like this:
!es6
Only the
stream is rewritten. If you pass in a callback, it'll get the expectederrandbodyarguments.errorifyis meant to be used with something like 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
$3
js`
var browserify = require('browserify');
var errorify = require('errorify');
var b = browserify({ /.../ });
b.plugin(errorify, / errorify options /);replacer#### Options
*
_(optional)_ is a function that takes an error as its first argument, and returns a string that will be used as the output bundle.errorify$3
After installing
as a local devDependency, you can use the--pluginor-poption like so:`sh`
watchify index.js -o bundle.js -p errorify$3
The added
tag has the class nameerrorify, so you can customize errors in your page like so:`css``
body > .errorify {
color: red;
font-family: 'Consolas', monospace;
padding: 5px 10px;
}License
MIT.