Skip to content

🎥 Make videos programmatically with React

fix: use namespace import for Node 16 compatibility

pullfrog[bot]8afbff179dc0
diff --git a/packages/renderer/src/get-cpu-count.ts b/packages/renderer/src/get-cpu-count.ts
index 8a943efaef..5ff4d37610 100644
--- a/packages/renderer/src/get-cpu-count.ts
+++ b/packages/renderer/src/get-cpu-count.ts
@@ -3,7 +3,7 @@
// However, Node.js returns the core count of the host system (up to 96!)
import {execSync} from 'node:child_process';
-import {availableParallelism, cpus} from 'node:os';
+import os from 'node:os';
let nprocCount: number | null | undefined;
@@ -28,11 +28,11 @@ export const getConcurrencyFromNProc = (): number | null => {
const getNodeCpuCount = (): number => {
// os.availableParallelism() is faster and respects cgroup CPU limits in containers.
// Available since Node 18.14 / 19.4.
- if (typeof availableParallelism === 'function') {
- return availableParallelism();
+ if (typeof os.availableParallelism === 'function') {
+ return os.availableParallelism();
}
- return cpus().length;
+ return os.cpus().length;
};
export const getCpuCount = () => {