1. errorify
Browserify plugin to write failed build error messages to the output file
errorify
Package: errorify
Created by: zertosh
Last modified: Fri, 17 Jun 2022 08:27:39 GMT
Version: 0.3.1
License: MIT
Downloads: 4,054
Repository: https://github.com/zertosh/errorify

Install

npm install errorify
yarn add errorify

errorify

A browserify plugin that writes the error message of a failed build to the output file, rendering it in the browser.

Build Status

Example

 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

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

API

 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:

 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:

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

License

MIT.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code