Hi,
I want to be able to import the Module object from another file (a worklet-processor in my case).
The problem is that if I have a worker, it will evaluate the "export default Module", I guess it's because of a "eval(...)" in importScript().
I tried appending :
if (ENVIRONMENT_IS_WEB == 1)
{
export default Module;
}
but I am getting this error :
Uncaught SyntaxError: Unexpected token 'export'
Here is the context :
<script async type="module" src="./experimental.js"></script>
<script type="module">
import Module from "./experimental.js";
console.log(Module.wasmMemory.buffer.byteLength);
</script>
I tried a lot of things, including using -s MODULARIZE=1, which does not help because (in my case) it slows down the application a lot. And even with that, I couldn't use the same Module object instance in the worklet.
There is an example
here that works setting aside the fact that the audio context won't start because it's not initialized after a user gesture, but it won't work in my case with:
+#include <emscripten.h>
#include "emscripten/bind.h"
using namespace emscripten;
@@ -53,6 +53,11 @@ class VariableBufferKernel {
unsigned bytes_per_channel_ = 0;
};
+int main(){
+ EM_ASM(Module["noExitRuntime"] = true;);
+ return 0;
+}
I put the logs in a file.
Anyone has an idea on what I should do to try to solve this issue?
Thanks
Regards
Mehdi