I made a custom sourceset that contains js and was...
# multiplatform
z
I made a custom sourceset that contains js and wasm targets
Copy code
applyDefaultHierarchyTemplate {
    common {
        group("jsCommon") {
            withJs()
            withWasmJs()
        }
    }
}
However in
jsCommon
i'm unable to use the
kotlin.js.JsModule
annotation, it just isn't accessible A temporary workaround I'm doing is just
public expect annotation class JsModule(val import: String)
then having that typealiased in both source sets Shouldn't the JsModule be accessible from this common source?
e
upstream kotlin stdlib doesn't have a jsCommon source set, it defines JsModule twice: https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/js/src/kotlin/annotationsJs.kt#L104 https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/wasm/js/src/kotlin/js/annotations.kt#L69 so I think what you're seeing is expected behavior (although not very desirable)
z
I see. Do you think it would be worth making a post on YouTrack to request this, if not already requested?
e
No it should not be accessible.
jsCommon
is your own custom source set with no knowledge of K/JS or K/WASM. There is no official support for code sharing between JS and WASM/JS, and I think you'll get the issue immediately backlogged, if one doesn't exist already.
z
Oh well, thanks for the answers anyway