Replies: 3 comments 3 replies
-
See the MDN documentation. Though your error message seems to indicate that there is a problem with the module you passed. I'm happy to look at it more closely if you put together a very minimal example. |
Beta Was this translation helpful? Give feedback.
-
Hi @daxpedda thank you for helping me. Let me ask a slightly different question. Please correct my understanding if it is wrong. Wasm is its own technology and runtime. A wasm module does not store any js with its module. Therefore the imports are needed in order to provide any js that may be used by the wasm module. Also in the mdn examples there is this sample for the importObject: |
Beta Was this translation helpful? Give feedback.
-
I'm new to wasm so it's a bit hard even asking the right questions. Anyway thank you for your help. I'll noodle on this a bit more and come back if I still need some help |
Beta Was this translation helpful? Give feedback.
-
I've looked at the js examples for WebAssembly.instantiate and the values given for the importObjects parameter, but I'm still confused as to what this importObjects parameter is supposed to be. In my case I'm trying to create a wasm module that wraps some js, so I can use it inside my other wasm modules. The first set of code I show below is my wrapper wasm module. As you can see I import Irys and the new constructor and export a function called connect_to_irys. Then the next code is my failing attempt at importing this wrapper module into another wasm module. I get the error "Import #0 module="./wasm_game_of_life_bg.js": module is not an object or function" at the line WebAssembly::instantiate_buffer.
For this sample code what is the importObjects parameter supposed to look like? What is importObjects purpose?
the wrapper module
The module importing the wrapper module:
Beta Was this translation helpful? Give feedback.
All reactions