Skip to content

Commit 180359d

Browse files
authored
Merge pull request #26 from rschristian/fix/worker-pool
refactor: Moves WorkerPool creation to `apply()`
2 parents 59fa989 + d366578 commit 180359d

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
@@ -88,11 +88,6 @@ export default class OptimizePlugin {
8888
if (this.options[i] == null) this.options[i] = DEFAULT_OPTIONS[i];
8989
}
9090

91-
this.workerPool = new WorkerPool({
92-
workerPath: require.resolve('./worker'),
93-
concurrency: this.options.concurrency
94-
});
95-
9691
// const { concurrency } = options;
9792
// const workerPath = require.resolve('./worker');
9893
// if (concurrency === 0 || concurrency === false) {
@@ -470,6 +465,11 @@ export default class OptimizePlugin {
470465
}
471466

472467
apply (compiler) {
468+
this.workerPool = new WorkerPool({
469+
workerPath: require.resolve('./worker'),
470+
concurrency: this.options.concurrency
471+
});
472+
473473
compiler.hooks.compilation.tap(NAME, compilation => {
474474
this.updateChunkHash(compilation);
475475

0 commit comments

Comments
 (0)