Closed mPaella closed 1 year ago
This appears to be a problem with wasm-pack
actually, ill bring it up over there
Hi @mPaella ! Why did you choose the node csl version and not the browser version ?
@lisicky I'm using @blockfrost/blockfrost-js
which uses the node package.
Which i'm pretty confident is correct, as the code isn't being run in the browser.
If you are familiar with NextJs, in the reproduction you will see that the code is being run inside getServerSideProps
(working correctly, pages directory, node env), as well as inside the async server component (NOT working, app directory, still node env)
Thanks for clarification @mPaella ! It's better to create issue in Wasm-pack or next.js repo. Because it is issue of third-party tool
Seems it was done by https://github.com/vercel/next.js/issues/49783
Problem
The compiled lib uses
__dirname
to resolve the path tocardano_serialization_lib_bg.wasm
file, which does not always resolve correctly. CausingError: ENOENT: no such file or directory, open '/project/sandbox/.next/server/app/foo/cardano_serialization_lib_bg.wasm'
Reproduction
https://codesandbox.io/p/sandbox/gifted-einstein-mo56ss?file=%2Fnext.config.js%3A19%2C7
/
. See that the page loads/foo
. See that the page errors, due to incorrectly deriving the path to the WASM fileFix?
As a hack to see if i could fix it, I tried editing the compiled files for
@emurgo/cardano-serialization-lib
undernode_modules
.OLD - Not working - line ~14053 in the compiled code
NEW - Working