You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears whenever I try to import from a WASm bundle which contains an exported struct a TypeError: WebAssembly.instantiate() is thrown. I simplified down the struct I was trying to export to just be:
#[wasm_bindgen]pubstructSimpleStruct{value:i32,}#[wasm_bindgen]impl{pubfnnew(value:i32) -> SimpleStruct{SimpleStruct{ value }}}
And I'm still getting the error? Could this be something to do with the WASM module not being generated correctly? It seemed pretty normal when I checked and compared it to the expected output of exporting a struct on this page.
I'm using Parcel bundler to create a simple website using WASM, I'm aware of the lack of compatibility between the two out of the box so I am simply recompiling my Rust package when I need to and then pointing the TS files at the generates JS file in the pkg directory.
Steps to Reproduce
Copy above code + some arbitrary function exported to WASM
Compile with wasm-pack build.
Import arbitrary function inJS.
Serve local JS and observe error.
If applicable, add a link to a test case (as a zip file or link to a repository we can clone).
Expected Behavior
Importing from the bundle should not error if it contains a struct being exported.
Actual Behavior
TypeError: WebAssembly.instantiate() is thrown regardless of structs' contents.
Additional Context
Full error message: Uncaught (in promise) TypeError: WebAssembly.instantiate(): Imports argument must be present and must be an object
The text was updated successfully, but these errors were encountered:
Thanks for the quick response @Pauan I do not get the error with webpack, I had a feeling it would be a Parcel issue. Do you have any idea what might be causing this so I could relay this to the Parcel team and try and get a fix for this going? :)
Describe the Bug
It appears whenever I try to import from a WASm bundle which contains an exported
struct
aTypeError: WebAssembly.instantiate()
is thrown. I simplified down the struct I was trying to export to just be:And I'm still getting the error? Could this be something to do with the WASM module not being generated correctly? It seemed pretty normal when I checked and compared it to the expected output of exporting a struct on this page.
I'm using Parcel bundler to create a simple website using WASM, I'm aware of the lack of compatibility between the two out of the box so I am simply recompiling my Rust package when I need to and then pointing the TS files at the generates JS file in the
pkg
directory.Steps to Reproduce
wasm-pack build
.If applicable, add a link to a test case (as a zip file or link to a repository we can clone).
Expected Behavior
Importing from the bundle should not error if it contains a struct being exported.
Actual Behavior
TypeError: WebAssembly.instantiate()
is thrown regardless of structs' contents.Additional Context
Full error message:
Uncaught (in promise) TypeError: WebAssembly.instantiate(): Imports argument must be present and must be an object
The text was updated successfully, but these errors were encountered: