diff --git a/nodejs/core.js b/nodejs/core.js index 259891a2bbcd97e6630855087547fb1b5a389876..768a8321cbf31212e5a31b075d44706803a362a8 100644 --- a/nodejs/core.js +++ b/nodejs/core.js @@ -786,8 +786,17 @@ module.exports.__wbindgen_throw = function(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; -const path = require('path').join(__dirname, 'core_bg.wasm'); -const bytes = require('fs').readFileSync(path); +const path = require('path'); +const fs = require('fs'); +const wasmPath = path.join(__dirname, 'core_bg.wasm'); +let bytes; +try { + bytes = fs.readFileSync(wasmPath); +} catch { + bytes = fs.readFileSync( + path.join(path.dirname(process.execPath), 'onepassword-core_bg.wasm'), + ); +} const wasmModule = new WebAssembly.Module(bytes); const wasmInstance = new WebAssembly.Instance(wasmModule, imports);