From e3199939b02239ca38dd9ab1be02973cf1e3e7d3 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 14 Dec 2022 13:48:11 -0500 Subject: [PATCH] *Bug fix path loading *Ensure process.pkg is unset as it causes loady to behave differently, and we do not need it --- src/index.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 7cafb3a..3286f60 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,13 +10,18 @@ const loaderFunction = `function loadNativeModuleTemp(module, data) { const tempDir = require("os").tmpdir(); const fs = require("fs"); const path = require("path"); - const outputPath = path.join(tempDir, module, "build", "Release"); + const loadPath = path.join(tempDir, module); + const outputPath = path.join(loadPath, "build", "Release"); const modulePath = path.join(outputPath, module + ".node"); fs.mkdirSync(outputPath, { recursive: true }); fs.writeFileSync(modulePath, Buffer.from(data, "base64")); - return modulePath; + if (process.pkg) { + process.pkg = undefined; + } + + return loadPath; }`; type Edit = [number, number];