I'm trying to follow
How to return a string (or similar) from Rust in WebAssembly?
Which allows accessing String data inside a wasm module.
I have used wasm-pack build
to build a RUST module and I can access the methods exported but not the memory directly.
The webpack generated JavScript has a method that allows me to read Strings
function getStringFromWasm(ptr, len) {
return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len));
}
but it is not exported, if I hack this generated .js file to
export function getStringFromWasm(ptr, len)
I can access Strings returned by RUST code.
How can I configure the webpack code generator to give me similar access, or otherwise expose the module's exports.memory
?
Webpack does not seem to give me a handle on the module itself. I cant find a way to load the .wasm
file webpack generates with WebAssembly.instantiateStreaming()
since it seems to rely on the other generated files.