Try package downgrade

This commit is contained in:
Sander Declerck 2025-11-28 15:53:38 +01:00
parent ae9bc8a75d
commit 35ab58c440
No known key found for this signature in database
3 changed files with 11 additions and 28 deletions

View file

@ -35,25 +35,8 @@ async function bundleSafeChain() {
external: ["certifi"],
});
// Post-process: Force node-forge to use pure JavaScript
// This prevents segmentation faults in pkg binaries on Linux
let bundledContent = await readFile("./build/bin/safe-chain.cjs", "utf-8");
// 1. Set the option to true
bundledContent = bundledContent.replace(
/usePureJavaScript:\s*false/g,
"usePureJavaScript: true"
);
// 2. Replace all checks that would enable native crypto
// Change: if (!forge2.options.usePureJavaScript && ...)
// To: if (false && ...)
// This makes the native crypto branches unreachable
bundledContent = bundledContent.replace(
/!forge2\.options\.usePureJavaScript/g,
"false"
);
await writeFile("./build/bin/safe-chain.cjs", bundledContent);
}