Skip to content

Write HTML. Render video. Built for agents.

fix(engine): use static import for os.totalmem in ESM config

Miguel Ángel0620fa908d26
diff --git a/packages/engine/src/config.ts b/packages/engine/src/config.ts
index 84c13dfde0..29296e7dab 100644
--- a/packages/engine/src/config.ts
+++ b/packages/engine/src/config.ts
@@ -6,6 +6,8 @@
* fallbacks for backward compatibility during migration.
*/
+import { totalmem } from "os";
+
/**
* Full engine configuration. All fields are wired through the config
* object; env vars serve as backward-compatible fallbacks resolved
@@ -209,11 +211,7 @@ export const DEFAULT_CONFIG: EngineConfig = {
};
function getSystemTotalMb(): number {
- try {
- return Math.floor(require("os").totalmem() / (1024 * 1024));
- } catch {
- return 16384;
- }
+ return Math.floor(totalmem() / (1024 * 1024));
}
function memoryAdaptiveCacheLimit(): number {