From 436c81a9e70d67435b855ed7f644d3a590f95a9b Mon Sep 17 00:00:00 2001 From: Lars Willighagen Date: Sun, 29 Apr 2018 19:00:16 +0200 Subject: [PATCH] Check if result is null This may be the case if files are ignored. I do not know what the other cases are, and if they should be handled differently, but at least they don't cause error like this. See #265 --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 5151d96..d17eda5 100644 --- a/index.js +++ b/index.js @@ -28,7 +28,7 @@ Babelify.prototype._flush = function (callback) { this.emit("error", err); } else { this.emit("babelify", result, this._filename); - var code = result.code; + var code = result !== null ? result.code : this._data; this.push(code); callback(); }