We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently, loading the .wasm files will fail in Node.js >16 or Next.js with the error:
"Failed to parse URL from /path/to/monero-ts/dist/dist/monero_wallet_full.wasm"
This is because the new fetch API does not support loading local files, as done here:
fetch
monero-ts/src/main/ts/common/LibraryUtils.ts
Line 86 in f70ace6
And here:
Line 109 in f70ace6
A workaround in Node.js is to pass --no-experimental-fetch to node, but this doesn't work Next.js apps.
--no-experimental-fetch
node
This issue requests updating monero-ts to load the .wasm files which works with the new fetch API.
For proof of concept, the fix should work in the sample Next.js app, and the --no-experimental-fetch flag should no longer be needed.
See related issue #180 for more commentary.
The text was updated successfully, but these errors were encountered:
Might be a viable option until the next emscription PR is ready.
Copy of my message from earlier in matrix:
diff --git a/node_modules/monero-ts/dist/src/main/ts/common/LibraryUtils.js b/node_modules/monero-ts/dist/src/main/ts/common/LibraryUtils.js index 30c4052..86ebd61 100644 --- a/node_modules/monero-ts/dist/src/main/ts/common/LibraryUtils.js +++ b/node_modules/monero-ts/dist/src/main/ts/common/LibraryUtils.js @@ -86,7 +86,10 @@ class LibraryUtils { if (LibraryUtils.WASM_MODULE) return LibraryUtils.WASM_MODULE; // load module + const fetch_ = globalThis.fetch; + globalThis.fetch = undefined; // prevent fetch in worker let module = await require("../../../../dist/monero_wallet_keys")(); + globalThis.fetch = fetch_; LibraryUtils.WASM_MODULE = module; delete LibraryUtils.WASM_MODULE.then; LibraryUtils.initWasmModule(LibraryUtils.WASM_MODULE); @@ -106,7 +109,10 @@ class LibraryUtils { if (LibraryUtils.WASM_MODULE && LibraryUtils.FULL_LOADED) return LibraryUtils.WASM_MODULE; // load module + const fetch_ = globalThis.fetch; + globalThis.fetch = undefined; // prevent fetch in worker let module = await require("../../../../dist/monero_wallet_full")(); + globalThis.fetch = fetch_; LibraryUtils.WASM_MODULE = module; delete LibraryUtils.WASM_MODULE.then; LibraryUtils.FULL_LOADED = true;
Sorry, something went wrong.
No branches or pull requests
Currently, loading the .wasm files will fail in Node.js >16 or Next.js with the error:
"Failed to parse URL from /path/to/monero-ts/dist/dist/monero_wallet_full.wasm"
This is because the new
fetch
API does not support loading local files, as done here:monero-ts/src/main/ts/common/LibraryUtils.ts
Line 86 in f70ace6
And here:
monero-ts/src/main/ts/common/LibraryUtils.ts
Line 109 in f70ace6
A workaround in Node.js is to pass
--no-experimental-fetch
tonode
, but this doesn't work Next.js apps.This issue requests updating monero-ts to load the .wasm files which works with the new fetch API.
For proof of concept, the fix should work in the sample Next.js app, and the
--no-experimental-fetch
flag should no longer be needed.See related issue #180 for more commentary.
The text was updated successfully, but these errors were encountered: