A browserify plugin that writes the error message of a failed build to the output file, rendering it in the browser.
Examplewatchify 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:
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. 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 APIOptionsvar browserify = require('browserify');
var errorify = require('errorify');
var b = browserify({  });
b.plugin(errorify, );
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.After installing errorify
as a local devDependency, you can use the --plugin
or -p
option like so:
CSS Customizationwatchify index.js -o bundle.js -p errorify
The added <pre>
tag has the class name errorify
, so you can customize errors in your page like so:
Licensebody > .errorify {
  color: red;
  font-family: 'Consolas', monospace;
  padding: 5px 10px;
}
MIT.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4