Thread
#multiplatform
    u

    untwisted

    3 years ago
    Hello, all. I’m using multiplatform and trying to figure out how to specify the multiplatform equivalent of
    compileKotlin2Js.kotlinOptions.moduleKind = "commonjs"
    in the project’s
    build.gradle
    , but Gradle is saying that it can’t find
    compileKotlin2Js
    which I suspect is because this is multiplatform. Is there a way to specify this option in a multiplatform build?
    Figured it out! For anyone else that has this problem I used:
    kotlin {
      targets {
        fromPreset(presets.jvm, 'jvm')
        fromPreset(presets.js, 'js') {
          compilations.all {
            tasks[compileKotlinTaskName].kotlinOptions {
              moduleKind = "commonjs"
            }
          }
        }
      }
    gildor

    gildor

    3 years ago
    I believe that
    tasks
    is not a property of
    compilation
    this is just a top level property
    so you can move it out of
    kotlin{}
    dsl block
    also, you don’t need tasks to configure
    kotlinOptions
    , there is
    kotlinOptions
    inside compilation