Skip to content

Commit 0744e51

Browse files
committed
refactor: Moves WorkerPool creation to apply()
1 parent 15c02bb commit 0744e51

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@ export default class OptimizePlugin {
8282
if (this.options[i] == null) this.options[i] = DEFAULT_OPTIONS[i];
8383
}
8484

85-
this.workerPool = new WorkerPool({
86-
workerPath: require.resolve('./worker'),
87-
concurrency: this.options.concurrency
88-
});
89-
9085
// const { concurrency } = options;
9186
// const workerPath = require.resolve('./worker');
9287
// if (concurrency === 0 || concurrency === false) {
@@ -456,6 +451,11 @@ export default class OptimizePlugin {
456451
}
457452

458453
apply (compiler) {
454+
this.workerPool = new WorkerPool({
455+
workerPath: require.resolve('./worker'),
456+
concurrency: this.options.concurrency
457+
});
458+
459459
compiler.hooks.compilation.tap(NAME, compilation => {
460460
this.updateChunkHash(compilation);
461461

0 commit comments

Comments
 (0)