```val compileKotlin2Js by getting(org.jetbrains.k...
# javascript
b
Copy code
val compileKotlin2Js by getting(org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile::class)
compileKotlin2Js.apply { kotlinOptions.moduleKind = "commonjs" }
Also tried:
Copy code
plugins {
    kotlin("multiplatform") version "1.3.61"
    id("kotlinx-serialization") version "1.3.61"
    id("kotlin2js") version "1.3.61"
}
but I get An exception occurred applying plugin request [id: 'kotlin2js', version: '1.3.61', artifact: 'org.jetbrains.kotlinkotlin gradle plugin1.3.61']
Failed to apply plugin [id 'kotlin2js']
> Cannot add extension with name 'kotlin', as there is an extension already registered with that name.
Hmm so Kotlin2js is deprecated and there are undocumented options with the new system.
finally got it to work