Skip to content

Commit

Permalink
refactor: remove stale code (#3035)
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Feb 20, 2021
1 parent 9b6b5c1 commit 500283e
Showing 1 changed file with 1 addition and 31 deletions.
32 changes: 1 addition & 31 deletions test/server/utils/DevServerPlugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,7 @@ const normalize = (entry) => entry.split(path.sep).join('/');

describe('DevServerPlugin util', () => {
async function getEntries(compiler) {
const entryOption = compiler.options.entry;
if (isWebpack5) {
const entries = [];

const compilation = {
addEntry(_context, dep, _options, cb) {
if (!dep.loc.name) {
entries.push(dep.request);
}
cb();
},
};
await Promise.all(
compiler.hooks.make.taps
.filter((tap) => tap.name === 'DevServerPlugin')
.map((tap) => tap.fn(compilation))
);

// normalize entry descriptors
if (typeof entryOption === 'function') {
// merge entries into the dynamic entry function
Object.assign(entryOption, entries);
return entryOption;
} else if (entryOption.main) {
entries.push(...entryOption.main.import);
}
// merge named exports into entries
Object.assign(entries, entryOption);
return entries;
}
return entryOption;
return compiler.options.entry;
}

it('should preserves dynamic entry points', (done) => {
Expand Down

0 comments on commit 500283e

Please sign in to comment.