diff --git a/Gulpfile.mjs b/Gulpfile.mjs index 8560537a78ac..bcea77b71ec5 100644 --- a/Gulpfile.mjs +++ b/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"; @@ -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"); }