Skip to content

Commit

Permalink
fix(terser): always make at least 1 worker thread (rollup#1594)
Browse files Browse the repository at this point in the history
  • Loading branch information
easrng committed Oct 8, 2023
1 parent 841a039 commit 90f6af4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/terser/src/worker-pool.ts
Expand Up @@ -40,7 +40,9 @@ export class WorkerPool extends EventEmitter {
constructor(options: WorkerPoolOptions) {
super();

this.maxInstances = options.maxWorkers || cpus().length;
// cpus() can return [] on some platforms,
// and we always need at least 1 worker
this.maxInstances = options.maxWorkers || cpus().length || 1;
this.filePath = options.filePath;

this.on(freeWorker, () => {
Expand Down

0 comments on commit 90f6af4

Please sign in to comment.