Tested with kotlin("multiplatform") version 1.9.21, Node 22.0.0, Deno 1.39.1 .
- Open this repo in devcontainer, e.g. using Github Codespaces. Type or copy/paste following commands to devcontainer's terminal.
cd
into the folder of this example:
cd node-and-deno
- Compile the example:
./gradlew build
The compilation result will be in ./build/js/packages/node-example-wasm-js/kotlin/
folder.
- Run with Node:
./gradlew wasmJsNodeRun
This task will download WASM-GC-enabled build of Node (22.0.0-v8-canary) and will run the node-example-wasm-js.mjs
with it.
- Install Deno:
curl -fsSL https://deno.land/x/install/install.sh | sh
- Apply a small patch to
node-example-wasm-js.uninstantiated.mjs
to allow it run in Deno:
sed -si.bak 's/const isNodeJs =.*/const isNodeJs = true/' build/js/packages/node-example-wasm-js/kotlin/node-example-wasm-js.uninstantiated.mjs
- Run with Deno:
~/.deno/bin/deno run --allow-read --allow-net build/js/packages/node-example-wasm-js/kotlin/node-example-wasm-js.mjs
Perform your own experiments if desired.