From 04c2af1cfde20d0bcbbce2bc58cd067016786e4d Mon Sep 17 00:00:00 2001 From: Richard Kimber Date: Tue, 21 Nov 2017 14:18:04 +0000 Subject: [PATCH 1/2] Entry fix --- index.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f161bc2..4317e0b 100644 --- a/index.js +++ b/index.js @@ -25,6 +25,27 @@ var defaultStatsOptions = { errorDetails: false }; +function validEntry(entry) { + if (!entry) { + return false; + } + + // Arrays and strings + if (entry.length > 1) { + return true; + } + + var type = typeof entry; + + // Objects and promises + if (type === 'object' && !entry.then && Object.getOwnPropertyNames(entry)) { + return false; + } + + // Functions + return type === 'function'; +} + module.exports = function (options, wp, done) { options = clone(options) || {}; var config = options.config || options; @@ -106,7 +127,7 @@ module.exports = function (options, wp, done) { config.watch = options.watch; entry = []; - if (!config.entry || config.entry.length < 1) { + if (!validEntry(config.entry)) { gutil.log('webpack-stream - No files given; aborting compilation'); self.emit('end'); return false; From 7461e13afffdb2c81387d72a506c6d14aeee348b Mon Sep 17 00:00:00 2001 From: Richard Kimber Date: Tue, 21 Nov 2017 14:18:27 +0000 Subject: [PATCH 2/2] Added space --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 4317e0b..d259fd3 100644 --- a/index.js +++ b/index.js @@ -25,7 +25,7 @@ var defaultStatsOptions = { errorDetails: false }; -function validEntry(entry) { +function validEntry (entry) { if (!entry) { return false; }