I am currently trying to setup a multiplatform pro...
# javascript
f
I am currently trying to setup a multiplatform project too but I am struggling with embedding the web app. It seems like
create-react-kotlin-app
is not the right choice (as that is more for standalone webapps with kotlin). The kotlin frontend plugin seem to be deprecated so I've tried it as plugin
multiplatform
and then only have
js { browser() }
configured (I assume that is currently the recommended way?). But now when I try to include the dependency to my commons library (which is also
multiplatform
and has
js()
as one of its target) I receive the error:
project ':clients:clients-common' is not configured for JS usage
any idea what I am missing or am I going completely off the rails with my setup?
👍 1
b
Did you solve it?
I have a toy project MPP js/jvm if you want
f
@bjonnh Not solved yet but where in that repo does it use MPP? I've seen plenty of JS MPP projects but none that uses a shared sperate library and a separate Kotlin JS project that uses that commons library.
b
you may have to check the vue-kotlin branch
that's where I try things
oh I see what you mean, ok it may not be what you were looking for
From what I understand the libraries are published as different artifacts: ktor-common, ktor-js, ktor (jvm)
i
Hi, you need to declare explicit subtarget for your js target, browser or nodejs in common module Not js(), but js { browser { } nodejs { } }
f
Ah so in my commons I need to explicit declare it as for example
browser
if that is where I plan to use my commons library? because the final frontend project is declared as
js { browser() }
but my commons library just has
js()
for now.
b
yep I think you need to specify it they are quite drastically different.
i
It is important, because it defines where we will run tests: in browser or in node, and it makes sense in common module too
f
Well I don't have tests but I will give it a try
@Ilya Goncharov [JB] Thank you very much that fixed it 🙂 Not sure but you guys might want to document that. Couldn't find any reference in the multiplatform documentation about the importance of that
👍 1
181 Views