Anyone have an example of adding an npm dependency...
# korge
j
Anyone have an example of adding an npm dependency to a Korge project? The Kotlin documentation says to use
npm()
but that doesn't seem to resolve.
d
never tried, but in the end korge just installs the kotlin multiplatform plugin, you should be able to put something like:
Copy code
dependencies {
    implementation(npm("react", "> 14.0.0 <=16.9.0"))
}
j
I did get this figured out (my kotlin mp plugin was apply=false 🤦‍♂️ ) but I think I've suffered from the XY problem. I guess npm packages are for running headless, and what I should use instead is
<script src="MY_DEPENDENCY"></script>
(my day job is Android so don't know js too well.) So the next question is:
a
<script>
is not the recommended way. Find it's
npm
directory and use the method above