I got Kotlin 1.9.21 + WASM GC + WASI working in Ok...
# webassembly
j
I got Kotlin 1.9.21 + WASM GC + WASI working in Okio, though it took some Gradle work. If you run into this
Copy code
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'wasi' imported from /Volumes/Development/okio/okio/build/compileSync/wasmWasi/test/testDevelopmentExecutable/kotlin/okio-parent-okio-wasm-wasi-test.mjs
Or this:
Copy code
file:///Volumes/Development/okio/okio/build/compileSync/wasmWasi/test/testDevelopmentExecutable/kotlin/okio-parent-okio-wasm-wasi-test.mjs:15
const wasmModule = new WebAssembly.Module(wasmBuffer);
                   ^
CompileError: WebAssembly.Module(): supertype count of 5663 exceeds internal limit of 1 @+372
    at file:///Volumes/Development/okio/okio/build/compileSync/wasmWasi/test/testDevelopmentExecutable/kotlin/okio-parent-okio-wasm-wasi-test.mjs:15:20
Or this:
Copy code
Successfully started process 'command '/Users/jwilson/.gradle/nodejs/node-v21.0.0-v8-canary202309143a48826a08-darwin-arm64/bin/node''
warning You are using Node "21.0.0-v8-canary202309143a48826a08" which is not supported and may encounter bugs or unexpected behavior. Yarn supports the following semver range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0"
error mocha@10.2.0: The engine "node" is incompatible with this module. Expected version ">= 14.0.0". Got "21.0.0-v8-canary202309143a48826a08"
error Found incompatible module.
Then paste this into your root project’s
build.gradle.kts
:
Copy code
/**
 * Select a NodeJS version with WASI and WASM GC.
 * <https://github.com/Kotlin/kotlin-wasm-examples/blob/main/wasi-example/build.gradle.kts>
 */
plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin> {
  extensions.getByType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().apply {
    nodeVersion = "21.0.0-v8-canary202309143a48826a08"
    nodeDownloadBaseUrl = "<https://nodejs.org/download/v8-canary>"
  }
  // Suppress an error because yarn doesn't like our Node version string.
  //   warning You are using Node "21.0.0-v8-canary202309143a48826a08" which is not supported and
  //   may encounter bugs or unexpected behavior.
  //   error typescript@5.0.4: The engine "node" is incompatible with this module.
  tasks.withType<org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask>().all {
    args += "--ignore-engines"
  }
}
thank you color 5
👏 2
🚀 2