Hi All, i have a some questions about targeting JS...
# multiplatform
f
Hi All, i have a some questions about targeting JS in multiplatform libraries. At our company we have gradually adopted Kotlin Multiplatform to share many different internal libraries between Android & iOS while keeping the UI layer native (i.e. Jetpack compose for android, SwiftUI for iOS). Recently, we are trying to add JS target to those multiplatform libraries in order to use it in a front-end JS application made with React. I've successfully added the target to some of the libraries (lets call them LibFoo and LibBar) and added
@JSExport
to classes / declarations i'd like to use from the JS react app. My questions are: • what is the recommended way to use kotlin JS libraries in a pure JS react app? • Should i publish LibFoo and LibBar as separate npm packages and install them separately? can this approach cause any runtime issues? like for example std-lib / other common dependencies included multiple times with potentially different versions? • Should i have an "umbrella" kotlin multiplatform gradle project alongside the react JS that export all the declaration needed by the JS app? is there any mechanism similar to
export
for iOS binary that export all the declarations marked with
@JSExport
of a kotlinJS lib from gradle to JS ? • Are there other options? are there any example available? thanks in advance for any help you can provide