Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down