rivu.chakraborty
11/15/2023, 10:22 AMTypeError: ioDispatcher(.. .plus_rgw9wi_ ks is not a function
Code:
fun ioDispatcher() = Dispatchers.Default
//---------------------------
val job = Job()
val scope = CoroutineScope(ioDispatcher() + job)
We believe it's because while transpiling the Kotlin compiler is renaming the methods and they're different for the SDKs and one SDK is trying to resolve it from another.
Without making a monorepo and co-building both the SDKs, is there any other way to share a common kotlin-js dependency or avoid the above error?
CC @Sebastian Aigner @Arnav GuptaSebastian Aigner
11/15/2023, 1:45 PMrivu.chakraborty
11/15/2023, 2:14 PManton.bannykh
11/15/2023, 2:16 PMWe believe it's because while transpiling the Kotlin compiler is renaming the methods and they're different for the SDKs and one SDK is trying to resolve it from another.Most probably that's the cause.
Without making a monorepo and co-building both the SDKs, is there any other way to share a common kotlin-js dependency or avoid the above error?As you've mentioned, we would suggest to build all the
.js
code together at once so that all the names match.
Otherwise it's kinda tricky. What you could do is mark the common library API with @JsExport
. This way you'll force the compiler to use the non-mangled names, which will of course be stable.rivu.chakraborty
11/15/2023, 2:18 PM@JSExport
for all functions and classes that's supposed to be called from js directly, should we do that for the functions we call from jsMain as well?anton.bannykh
11/15/2023, 2:20 PMrivu.chakraborty
11/15/2023, 2:23 PManton.bannykh
11/15/2023, 2:23 PMrivu.chakraborty
11/15/2023, 2:24 PMandylamax
11/16/2023, 3:51 AM