Hi, I have updated <https://github.com/kowasm/kowa...
# webassembly
s
Hi, I have updated https://github.com/kowasm/kowasm to Kotlin 2.0.0 and NodeJS 22.3.0, the build itsef is fine but when I try to run my NodeJS samples, I get the following error:
Copy code
cd samples/web-server-sample
./run.sh

file:///Users/sdeleuze/workspace/kowasm/samples/web-server-sample/build/compileSync/wasmJs/main/productionExecutable/kotlin/kowasm-samples-web-server-sample-wasm-js.uninstantiated.mjs:112
        'org.nodejs.http.createServer_$external_fun' : (p0) => _ref_aHR0cA_.createServer(p0),
                                                                            ^
TypeError: Cannot read properties of undefined (reading 'createServer')
The related JS API does not seems to have change, I can also reproduce with the old NodeJS version I was using, so I tend to think it could be a change of behavior after upgrading from Kotlin
1.9.10
to
2.0.0
. Everything is pushed, so it should be easy to reproduce. Is it a Kotlin 2.0.0 regression or something I should refine on my side?
👀 1
s
Hi.
uninstantiated.mjs
now needs all the imports to be passed explicitly:
Copy code
-const { exports, instance } = await instantiate({ wasi_snapshot_preview1 : wasi.wasiImport }, false);
+import * as net from "net";
+import * as http from "http";
+const { exports, instance } = await instantiate({ wasi_snapshot_preview1 : wasi.wasiImport, net, http }, false);
s
Oh indeed, it works now. Thanks!
s
It used to fall back on ESM imports, but it was unconventional choice and people were confused. Now it is simpler, but a bit more verbose.
👍 1
s
I will migrate KoWasm WASI support to
wasmWasi
shortly.