Skip to content

Commit

Permalink
allow entry points as array
Browse files Browse the repository at this point in the history
  • Loading branch information
dwightjack committed Jan 15, 2019
1 parent 00c7a0f commit 2ef0fc4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const deepcopy = require('deepcopy');
const SingleEntryPlugin = require('webpack/lib/SingleEntryPlugin');
const MultiEntryPlugin = require('webpack/lib/MultiEntryPlugin');
const JsonpTemplatePlugin = require('webpack/lib/web/JsonpTemplatePlugin');
const SplitChunksPlugin = require('webpack/lib/optimize/SplitChunksPlugin');
const chalk = require('chalk');
Expand Down Expand Up @@ -53,7 +54,12 @@ class BabelEsmPlugin {
}

Object.keys(compiler.options.entry).forEach(entry => {
childCompiler.apply(new SingleEntryPlugin(compiler.context, compiler.options.entry[entry], entry));
const entryFiles = compiler.options.entry[entry]
if (Array.isArray(entryFiles)) {
childCompiler.apply(new MultiEntryPlugin(compiler.context, entryFiles, entry));
} else {
childCompiler.apply(new SingleEntryPlugin(compiler.context, entryFiles, entry));
}
});

// Convert entry chunk to entry file
Expand Down

0 comments on commit 2ef0fc4

Please sign in to comment.