From 8147bc5a228b559a3546ab29ae4084647e169bbe Mon Sep 17 00:00:00 2001 From: Menzo Wijmenga Date: Sat, 18 Nov 2017 05:46:54 +0700 Subject: [PATCH] Add troubleshooting information for silenced errors --- readme.markdown | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/readme.markdown b/readme.markdown index 5904f84..1ec8e3f 100644 --- a/readme.markdown +++ b/readme.markdown @@ -134,7 +134,10 @@ b.on('update', bundle); bundle(); function bundle() { - b.bundle().pipe(fs.createWriteStream('output.js')); + b.bundle() + .on('error', console.error) + .pipe(fs.createWriteStream('output.js')) + ; } ``` @@ -221,6 +224,19 @@ and [stackoverflow](http://stackoverflow.com/questions/26708205/webpack-watch-is Try the `--poll` flag and/or renaming the project's directory - that might help. +## watchify swallows errors + +To ensure errors are reported you have to add a event listener to your bundle stream. For more information see ([browserify/browserify#1487 (comment)](https://github.com/browserify/browserify/issues/1487#issuecomment-173357516) and [stackoverflow](https://stackoverflow.com/a/22389498/1423220)) + +**Example:** +``` +var b = browserify(); +b.bundle() + .on('error', console.error) + ... +; +``` + # see also - [budo](https://www.npmjs.com/package/budo) – a simple development server built on watchify