I'm working on a new Kotlin/WASM project and this ...
# webassembly
s
I'm working on a new Kotlin/WASM project and this time I want to use skiko with it. I get the error
Module not found: Error: Can't resolve './skiko.mjs'
How do I correctly configure the project to use skiko? https://github.com/StefanOltmann/thumbnail-repair
1
o
s
So skiko for wasmJS is only usable together with Compose for Web, not alone?
o
I see, I rushed to reply after I noticed a familiar error message. Compose gradle plugin unpacks skiko. But if project doesn't need Compose, then you'll need to unpack it manually. Another example https://github.com/JetBrains/skiko/blob/master/samples/SkiaMultiplatformSample/build.gradle.kts 1. We create a custom configuration: https://github.com/JetBrains/skiko/blob/master/samples/SkiaMultiplatformSample/build.gradle.kts#L52 2. We create a custom task to unzip: https://github.com/JetBrains/skiko/blob/master/samples/SkiaMultiplatformSample/build.gradle.kts#L56C5-L56C14 3. add the unzipped folder to resources: https://github.com/JetBrains/skiko/blob/master/samples/SkiaMultiplatformSample/build.gradle.kts#L56C5-L56C14 4. add a task dependency: https://github.com/JetBrains/skiko/blob/master/samples/SkiaMultiplatformSample/build.gradle.kts#L236 (currently KotlinJsCompile task type is used for both k/js and k/wasm)
👍 2
🙏 1
s
Thank you, that was it. Got it working. 🙂
🎉 1
c
Sorry for replying on this old thread, but I just want to add my workaround, which is simply checking and removing any dependencies that is compose related. In my case, I had a KMP library with Decompose library. I accidentally added the
com.arkivanov.decompose:extensions-compose:3.1.0
library which transitively added some compose related dependencies. Once I removed this dependencies, issue is gone, without going through the manual unzip hack
And in case if anyone also encountered this issue, checkout https://github.com/Kotlin/kotlin-wasm-browser-template