https://kotlinlang.org logo
#javascript
Title
# javascript
p

prashan

03/28/2024, 3:13 PM
sort of tangential question: with our current setup, we have a kotlin multiplatform library that is in its own repo and consumed by clients in separate repos. specifically for our react client, i'd like to set up an
npm link
for local development. i've been trying to poke around and see which task and output i should be using. is using the
compileDevelopmentLibraryKotlinJs
and running
npm link
in
build/js/packages/<my-module>
correct? it seems there is also a
build/compileSync/js/main/developmentLibrary/kotlin
directory, but this doesn't seem to have a
package.json
🧵 1
e

Edoardo Luppi

03/28/2024, 3:17 PM
You need to link to the output of the library distribution task. Each target (nodejs, browser), has a
distribution
block that you can use to customize the output directory
p

prashan

03/28/2024, 3:18 PM
gotcha, but is the task (
compileDevelopmentLibraryKotlinJs
) correct?
e

Edoardo Luppi

03/28/2024, 3:19 PM
No, that is only related to Kotlin metadata. The actual JS distribution is outputted with tasks such as
jsBrowserProductionLibraryDistribution
p

prashan

03/28/2024, 3:19 PM
i see gotcha
thanks!
✔️ 1
ahh i see and now this creates a library in
build/dist/js/developmentLibrary
?
this roughly looks like the same output as the other task - with two more gradle tasks run after:
Copy code
> Task :jsBrowserDevelopmentLibraryPrepare
> Task :jsBrowserDevelopmentLibraryDistribution
i guess i'll have to dig into what these tasks are doing
e

Edoardo Luppi

03/28/2024, 3:24 PM
The production distribution may apply additional optimizations to the final package. But I don't recall which ones