Try set pure javascript for node-forge

This commit is contained in:
Sander Declerck 2025-11-28 15:32:52 +01:00
parent 8ab4d2955a
commit 20420f865e
No known key found for this signature in database
3 changed files with 16 additions and 7 deletions

View file

@ -26,6 +26,15 @@ async function clearOutputFolder() {
}
async function bundleSafeChain() {
// Read the forge.js file and modify it to use pure JavaScript
const forgeContent = await readFile("./node_modules/node-forge/lib/forge.js", "utf-8");
const modifiedForge = forgeContent.replace(
"usePureJavaScript: false",
"usePureJavaScript: true"
);
await mkdir("./build/temp", { recursive: true });
await writeFile("./build/temp/forge.js", modifiedForge);
await build({
entryPoints: ["./packages/safe-chain/bin/safe-chain.js"],
bundle: true,
@ -33,6 +42,9 @@ async function bundleSafeChain() {
target: "node24",
outfile: "./build/bin/safe-chain.cjs",
external: ["certifi"],
alias: {
"node-forge/lib/forge": "./build/temp/forge.js",
},
});
}