https://kotlinlang.org logo
Join Slack
Powered by
# webassembly
  • r

    Robert Jaros

    08/15/2025, 3:52 PM
    When testing Kotlin 2.2.20 (currently RC-266) I've noticed external classes declared in my code no longer work if there are no real classes in JS. More in thread 🧵
    👀 1
    t
    • 2
    • 26
  • s

    Stefan Oltmann

    08/17/2025, 6:05 PM
    I'm interested in doing a Cloudflare Worker with Kotlin - preferably Kotlin/WASM. Does someone know / have a working sample for the current Kotlin version (2.2.10)? https://github.com/cloudflare/kotlin-worker-hello-world is clearly outdated and they don't seem to care - see the open issues and PRs. I tried the fork https://github.com/bashor/kotlin-worker-hello-world/ , but that fails for me - so maybe outdated, too. https://developers.cloudflare.com/workers/languages/ still mentions Kotlin, but I'm not sure if that's up to date.
    ✅ 1
    c
    • 2
    • 9
  • v

    Vidmantas Kerbelis

    08/18/2025, 8:33 AM
    Knowing that Kotlin/Wasm currently is in Alpha. What are the risks of actually using it in production on a live app with potentially millions of users?
    a
    s
    r
    • 4
    • 9
  • e

    eygraber

    08/19/2025, 3:04 PM
    Will
    JsAny
    be supported in the shared source set? That's been the biggest issue for me when working with common web code. https://kotlinlang.org/docs/whatsnew-eap.html#shared-source-set-for-js-and-wasmjs-targets
    t
    • 2
    • 1
  • d

    David Breneisen

    08/19/2025, 9:13 PM
    Has anyone managed to call kotlin from javascript using the @JsExport annotation? I've been trying to implement the wasm version of the Google sign in button I have in my compose app. The only missing piece left is getting the data back to my kotlin code to finish the process, but I'm getting stuck and the info here seems outdated. Update - half resolved it but I think I've identified significant issues with the interoperability feature and documentation around it.
    t
    • 2
    • 5
  • s

    sdeleuze

    08/21/2025, 7:56 AM
    Exception handling support has just been merged in Wasmtime! https://github.com/bytecodealliance/wasmtime/issues/3427#issuecomment-3208867315 cc @bashor
    🎉 11
  • p

    PHondogo

    08/22/2025, 1:37 PM
    When building project (wasmJsBrowserDistribution) got three files: two with wasm extension (skiko and app) and one is with js extension. As i understand js file is used just to load wasm files. But i wonder why it is so heavy (2.84 mb)? Is it possible to reduce it? Using Kotlin 2.2.20-RC P.S. also noticed that it is not obfuscated and contains embedded source map.
    ⬆️ 1
    r
    • 2
    • 3
  • c

    chrisjenx

    08/22/2025, 6:42 PM
    Anyone else noticed that KT 2.2.0-beta2 > RC broke webpack? Now getting
    Cannot GET /
    when running lol
    r
    e
    a
    • 4
    • 13
  • r

    Robert Jaros

    08/24/2025, 5:44 AM
    I wonder why was "compatibility browser distribution" feature designed as part of Compose and not Kotlin (KGP) itself?
    ➕ 1
  • m

    Mario Andhika

    08/25/2025, 8:08 AM
    How to get geolocation in KMP wasmJs project? window.navigator.geolocation is not found
    ✅ 1
    v
    m
    t
    • 4
    • 5
  • m

    Michael Paus

    08/25/2025, 11:01 AM
    Can anybody tell me why the Kotlin stdlib does not implement IEEErem for JS and Wasm? https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.math/-i-e-e-erem.html
  • m

    Mario Andhika

    08/26/2025, 2:13 AM
    What usually cause this kind of error on wasmJs? Same code works on JVM and iOS
    Copy code
    WebAssembly.instantiateStreaming(): Compiling function #95814:"asia.zeals.mobile.pwa.ui.components.BTZTD$lambd..." failed: call[1] expected type (ref null 564), found if of type (ref null 6) @+11835139
    CompileError: WebAssembly.instantiateStreaming(): Compiling function #95814:"asia.zeals.mobile.pwa.ui.components.BTZTD$lambd..." failed: call[1] expected type (ref null 564), found if of type (ref null 6) @+11835139
    ✅ 1
    i
    • 2
    • 3
  • h

    Himanshu Kumar

    08/26/2025, 8:09 AM
    Hi guys, I am currently getting 2 wasm files with total size ~16MB (each of 8MB), after gzip/br the net size reduced to 5MBs (3 + 2). Is it possible to split those wasm files further into smaller chunks?
    z
    i
    • 3
    • 2
  • m

    Mario Andhika

    08/27/2025, 6:48 AM
    Anyone here successfully use Coil image library with wasmJs target?
    👌 2
    a
    • 2
    • 5
  • s

    Stefan Oltmann

    08/27/2025, 5:33 PM
    So, while indexeddb WASM support will take a while, what are the other currently available options to store/cache a 10 MB file in the browser? I asked ChatGPT & Gemini to generate me some code to use IndexDB, but that all failed. Are there other libraries out there that I missed?
    👀 1
    ✅ 1
    r
    e
    +4
    • 7
    • 100
  • h

    Himanshu Kumar

    08/28/2025, 5:48 PM
    Hi guys, I’m also facing noticeable lag while vertically scrolling lists. Any updates on this issue?
  • t

    Tristan

    08/30/2025, 1:52 AM
    Hello people, I want to create a common source for JS and WASM, I have something working, but I am not able to access functionalities that are present for both targets individually such as
    js()
    . It is available in both
    jsMain
    and
    wasmJsMain
    but not
    commonJsMain
    . What am I missing?
    Copy code
    applyDefaultHierarchyTemplate {
                common {
                    group("commonJsMain") {
                        withJs()
                        withWasmJs()
                    }
                }
            }
    
            val commonJsMain by creating {
                dependsOn(commonMain.get())
    
                dependencies {
                    implementation(libs.ktor.js)
                    implementation(kotlinWrappers.web)
                    implementation(kotlinWrappers.browser)
                    implementation(kotlinWrappers.js)
                }
            }
    
            val jsMain by getting {
                dependsOn(commonJsMain)
            }
    
            val wasmJsMain by getting {
                dependsOn(commonJsMain)
            }
    j
    t
    +2
    • 5
    • 7
  • s

    Sargun Vohra

    08/30/2025, 4:02 AM
    Is Kotlin/WASM able to interop with libraries written in other languages that compile to Wasm? For example, say I want to interop with a C++ library that I can build for WASM. How would I go about that interop in Kotlin? Are there docs, examples, or tools I can read up on?
    j
    m
    a
    • 4
    • 8
  • m

    Mario Andhika

    09/01/2025, 7:44 AM
    How to have a WebView inside Compose wasm app?
    i
    k
    m
    • 4
    • 3
  • t

    Tepes Lucian Victor

    09/01/2025, 8:20 PM
    playing around with CMP wasm app and I'm trying to call a kotlin function exported with
    JsExport
    from javascript - basically text input config with the wasm app as the preview as you edit the config. Haven't seen this example and when trying to `import { setConfig } from './composeApp.mjs';`in another js file i'm getting
    Failed to resolve module specifier "@js-joda/core". Relative references must start with either "/", "./", or "../".
    TypeError: Failed to resolve module specifier "@js-joda/core". Relative references must start with either "/", "./", or "../".
    . Thoughts?
    • 1
    • 2
  • t

    Tepes Lucian Victor

    09/02/2025, 7:26 PM
    Trying to use a npm js dependency in combination with
    WebElementView
    in a wasm app. Any samples that have this usecase?
    • 1
    • 1
  • h

    Himanshu Kumar

    09/09/2025, 5:24 AM
    Is anyone aware of a workaround for this? WebElementView stays interactive behind popups/dialogs — CMP-8903
  • e

    eygraber

    09/10/2025, 10:43 AM
    Is this something that KGP can eventually handle? It seems odd to have the overhead of source serving removed, but now have this overhead instead.
  • b

    bashor

    09/11/2025, 1:19 PM
    kodee happy Kotlin/Wasm is now Beta! In 2.2.20 it receives a lot of improvements. Try it now → kotl.in/wasm
    ❤️ 9
    .wasm 7
    🎉 20
  • e

    eygraber

    09/12/2025, 10:28 PM
    I started getting an error on some projects using wasm-js after updating to Kotlin 2.2.20 saying that there is no task
    kotlinWasmUpgradePackageLock
    . Did something change with that? Most of my projects don't have that issue.
    o
    • 2
    • 3
  • p

    phteven

    09/13/2025, 6:11 PM
    I want to set up compose multiplatform web in my existing project. I have a browser app written in react+typescript + shared code via kotlin multiplatform. Now I added the wasmJs target to my project but my @JsExport annotated classes fail in task compileKotlinWasmJs: This annotation is not applicable to target 'class'. Applicable targets: function. Actually I do not want to export it to wasmJs. Only to Js. My wasmJs target will stay inside the kotlin world. Are there any news around this topic?
  • m

    Matt Nelson

    09/15/2025, 8:53 AM
    So I've got an externally defined interface with a function on it. That function takes a callback function, but
    wasmJs
    keeps crying that I'm using
    Unit
    . Is there any way around this?
    Copy code
    @JsName("EventEmitter")
    internal external interface JsEventEmitter {
        fun on(
            event: String,
            listener: Function<Unit>,
        ): JsEventEmitter
    }
    Copy code
    Type 'Function<Unit>' cannot be used as value parameter type of JS interop function. Only external, primitive, string, and function types are supported in Kotlin/Wasm JS interop.
    r
    t
    • 3
    • 9
  • m

    martmists

    09/16/2025, 12:47 AM
    I'm trying to generate externals for https://github.com/bowser-js/bowser/, but no matter what I try, I either get
    TypeError: _ref_Ym93c2Vy_.getParser is not a function
    or
    NullPointerException: null
    and I'm not sure how to fix it. Usually I'd add
    generateExternals = true
    to npm() but it seems that's since been removed?
    k
    • 2
    • 2
  • m

    Michael Paus

    09/20/2025, 3:28 PM
    Wasm 3.0 has been released https://webassembly.org/news/2025-09-17-wasm-3.0/ What does that mean for Kotlin/Wasm?
    👀 4
    🎉 2
  • a

    Adolfo Ochagavía

    09/20/2025, 4:18 PM
    Is it currently possible / supported to compile a library as a wasm module, similar to how kotlin native compiles to a shared library? The Kotlin/Wasm docs seem to focus on executables and I haven't managed to adapt those examples to my library use case. For context, my use case is the following: I created a library in kotlin multiplatform, compiled it as a native shared library, created an idiomatic Python wrapper around the shared library's low-level functions, and published it to pip. One drawback I'd like to get rid of is the necessity to build and publish multiple artifacts, one per platform, because shared libraries are platform dependent. The easiest solution (as far as I can see) is to compile my library to wasm, which is platform independent, and ship that instead of a native shared library.