are there any examples of kotlin compiled to JS an...
# javascript
p
are there any examples of kotlin compiled to JS and consumed by Javascript? IOW a Javascript app which has a dependency on a kotlin lib? getting hung up on importing the kotlin compiled js. Sorry, JS newb here
f
A have an example using Kotlin `1.3.21`: https://github.com/felipehjcosta/marvel-client
a
I’m doing something similar but don’t have a public example yet. Happy to be a sounding board if you’re running into issues.
p
Thanks for the link. Its helpful, but not exactly what I'm thinking. lets say I have an existing JS React app, and I want to add some shared Kotlin code with the react app and an Android app, How would you use the output of the kotlinjs in the react app? I understand how to structure a MP app, and that the source is generated and where it is, and that kotlin.js is required. would you use an import? or require?
I'm importing my common output with `const common = require('./common') and I get undefined errors because the kotlin.js is not loaded
f
I needed to create a single js file with all dependencies inside via webpack: https://github.com/felipehjcosta/marvel-client/blob/master/library-js/webpack.config.js
s
I have an example using Kotlin
1.3.50
+ React.js https://github.com/subroh0508/kotlin-react-sample
p
Thanks for the link @Subroh Nishikori, but I'm trying to use the output of a kotlin module, in a JS React app. Not a React app written in Kotlin
b
@Patrick Jackson I’m curious why do you need to use Kotlin output this way? Is there something in react you cannot build without Kotlin?
g
@Patrick Jackson I’d like to do exactly what you are looking for, so I opened https://youtrack.jetbrains.com/issue/KT-32332