Skip to content

Commit

Permalink
resolving comments
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekbh committed Jun 12, 2019
1 parent 82e771d commit 25bc627
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,24 @@ class BabelEsmPlugin {
}

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

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

// Convert entry chunk to entry file
new JsonpTemplatePlugin().apply(childCompiler);

Expand Down

0 comments on commit 25bc627

Please sign in to comment.