Org.jetbrains.kotlin.js vs kotlin2js

I am pretty new to JS and found some conflicting libraries to use
Creating a new IJ project with kotlin/JS
Gradle has
plugins { id ‘org.jetbrains.kotlin.js’ }
dependencies {
implementation “ch.qos.logback:logback-classic:$logback_version”
implementation “org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version”
testImplementation “org.jetbrains.kotlin:kotlin-test-js”
}

However the official support demonstrates a (I guess a outdated Sample?)
apply plugin: ‘kotlin2js’
dependencies { compile “org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version” }

compileKotlin2Js.kotlinOptions.sourceMap = true
compileKotlin2Js.kotlinOptions.outputFile = “${projectDir}/web/js/app.js”
compileKotlin2Js.kotlinOptions.suppressWarnings = true
compileKotlin2Js.kotlinOptions.verbose = true

I could not find documentation to set the Options using the org.jetbrains.kotlin.js (witch seem to be a newer incarnation of the kotlin2js library)

I am trying to use teach myself by using samples like KotlinFullstackSample
Is there a Sample project I can use to educate myself? as my sample is also old!

I have the same problem. There is no documentation for the new kotlin.js plugin. Why do new projects in IntelliJ use the new plugin when it isn’t documented? It’s just making life harder.

The Kotlin team is trying to unify names of their Kotlin tools, phasing everything to org.jetbrains.kotlin.${PLUGIN_NAME}. Many plugins have been merged into others or have changed name to come to a common standard:

  • kotlin2js – (renamed) → org.jetbrains.kotlin.js
  • konan – (renamed) → org.jetbrains.kotlin.native
  • kotlin-frontend-plugin – (merged into) → org.jetbrains.kotlin.js
  • kotlin-android – (renamed) → org.jetbrains.kotlin.android
  • kotlin-android-extensions – (renamed) → org.jetbrains.kotlin.android.extensions

And many more that now slips my mind!

By personal experience use always the one with standardized name, and yes, the official documentation most of the time makes references to old names…

1 Like