Skip to content

Commit 301cd26

Browse files
committed
dynamic-entry-plugin: improve
1 parent 61dc513 commit 301cd26

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

server/build/plugins/dynamic-entry-plugin.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ export default class DynamicEntryPlugin {
77
compiler.addEntry = addEntry
88
compiler.removeEntry = removeEntry
99
compiler.hasEntry = hasEntry
10-
compiler.createCompilation = createCompilation(compiler.createCompilation)
10+
11+
compiler.plugin('compilation', (compilation) => {
12+
compilation.addEntry = compilationAddEntry(compilation.addEntry)
13+
})
1114
}
1215
}
1316

@@ -41,14 +44,6 @@ function hasEntry (name = 'main') {
4144
return this.entryNames.has(name)
4245
}
4346

44-
function createCompilation (original) {
45-
return function (...args) {
46-
const compilation = original.apply(this, args)
47-
compilation.addEntry = compilationAddEntry(compilation.addEntry)
48-
return compilation
49-
}
50-
}
51-
5247
function compilationAddEntry (original) {
5348
return function (context, entry, name, callback) {
5449
if (!this.compiler.entryNames.has(name)) {

0 commit comments

Comments
 (0)