kmp noob here: I see "wasm/js" thrown around a lot...
# multiplatform
c
kmp noob here: I see "wasm/js" thrown around a lot. Does that mean if I have a kmp js library it will also work on wasm?
f
Yes, still in alpha
c
INteresting! I thought js was js, and wasm was wasm. good to know! this opens up some more libraries for me to use since i want to target wasm, but they only support js
f
you can try
Copy code
js(IR) {
    browser()
    binaries.executable()
}
wasmJs {
    browser {
        val projectDirPath = project.projectDir.path
        commonWebpackConfig {
            devServer =
                (devServer ?: KotlinWebpackConfig.DevServer()).apply {
                    static =
                        (static ?: mutableListOf()).apply {
                            // Serve sources to debug inside browser
                            add(projectDirPath)
                        }
                }
        }
    }
}
There are more and more library starting to support WASM, like ktor
m
You can't use K/JS libraries with K/WASM, the library needs to support wasm.
s
It was pretty easy for me changing Ashampoo Kim for WASM & JS support. Basically I needed just to move all ktor stuff to the jvmMain package and replace the uses with something else. Chances are good that your multiplatform library is already compatible and it's just a matter of adding the targets.
f
My bad, Kotlin/JS is not directly compatible to Kotlin/Wasm, it must be explicitly declared.
m
They say wasm/js to distinguish it from wasi https://wasi.dev/
☝️ 1
e
"wasm on a js runtime"