https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
m

mzgreen

01/11/2020, 12:52 PM
I have a project with following structure:
Copy code
common
  - commonMain (contains expect classes)
  - jvmMain (contains actual classes for jvm)
  - jsMain (contains actual classes for js)
jvm (contains a jvm project and depends on common)
 - JVMMainClass
js (contains a js project and depends on common)
 - JSMainClass
the jvm works fine but I have a problem with js module.
JSMainClass
sees classes from common module but the implementations are from jvmMain instead of jsMain. How do I fix that?
d

Dominaezzz

01/11/2020, 4:11 PM
Which js plugin are you using?
m

mzgreen

01/11/2020, 4:14 PM
js
module build.gradle is pretty simple:
Copy code
apply plugin: 'kotlin2js'
apply plugin: 'kotlin-dce-js'

// just run assemble and it'll do what it has to do
dependencies {
    implementation project(':common')

    implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
}

compileKotlin2Js {
    kotlinOptions.moduleKind = 'commonjs'
}
classes declared in
common
module in
commonMain
source set are visible but I want to also see
jsMain
source set
d

Dominaezzz

01/11/2020, 4:18 PM
I'm not 100% sure (I don't do Kotlin/JS) but you might be using the old js plugin. https://blog.jetbrains.com/kotlin/2019/06/kotlin-1-3-40-released/
m

mzgreen

01/11/2020, 4:23 PM
yeah that seems to be it! thanks a lot 🙏