Skip to content

Commit

Permalink
fix: support compiling monorepo on single-core CPU machines (#14720)
Browse files Browse the repository at this point in the history
* fix: update build worker numbers

* address review comment
  • Loading branch information
JLHwung committed Jul 4, 2022
1 parent 6fd6ce1 commit d68be3f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Gulpfile.mjs
@@ -1,5 +1,6 @@
import path from "path";
import fs from "fs";
import { cpus } from "os";
import { createRequire } from "module";
import { fileURLToPath } from "url";
import plumber from "gulp-plumber";
Expand Down Expand Up @@ -222,7 +223,7 @@ function getFiles(glob, { include, exclude }) {
}

function createWorker(useWorker) {
const numWorkers = require("os").cpus().length / 2 - 1;
const numWorkers = Math.ceil(cpus().length / 2) - 1;
if (numWorkers === 0 || !useWorker) {
return require("./babel-worker.cjs");
}
Expand Down

0 comments on commit d68be3f

Please sign in to comment.