Skip to content

Commit

Permalink
Check if result is null
Browse files Browse the repository at this point in the history
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 babel#265
  • Loading branch information
larsgw committed Apr 29, 2018
1 parent c5e4d40 commit 436c81a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -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();
}
Expand Down

0 comments on commit 436c81a

Please sign in to comment.