Crosspost from <#C3PQML5NU|multiplatform>: <https:...
# javascript
a
Crosspost from #multiplatform: https://kotlinlang.slack.com/archives/C3PQML5NU/p1718797253173759 I want to use kotlin code in a React app and I want to do this without using any experimental features. Since "@JsExport" is still experimental, is the are any way to build a JS lib? Without this annotation, the js module is just empty and it doesn't matter if I write the code in the js source root or in the common source root.
a
Without @JsExport, you cannot export code from Kotlin to JavaScript (it's the only way). Why don't you want to use it? @JsExport (in most cases) is stable, but there are a few cases that we want to stabilize to move it forward (from experimental status). @JsExport, as a concept, will not be deleted. Only some ways of exporting could be changed in the future (such as exporting collections)
a
My hesitance comes only from the fact that it's marked as experimental and the docs for Kotlin clearly state, that experimental stuff shouldn't be used in production code. It's a bit harder to argue in favor of JsExport with that in mind. However, I think I have some strong arguments in favor of JsExport and Kotlin multi platform ❤️
c
Where is it marked "experimental" specifically? The annotations are always named XXXExperimental, even when something is of alpha or beta quality, because renaming the annotation would be a breaking change of the standard library, which is not allowed.
a
Ah, okay! Well that's it then. I mostly misunderstood the docs then. So it's just the typescript declarations which are still actually experimental?
c
I'm not sure, honestly. But @JsExport has been here since forever, I don't think it's possible that it goes away. Maybe they're keeping it unstable because there's some edge case somewhere that they're unsure about.
👍 1
e
The
@JsExport
concept makes perfect sense. What we're missing is a better way to configure it (e.g., per package, for transitive dependencies), but that's another story. You can definitely use it.
❤️ 1