How to configure new KotlinJS plugin?

With the old kotlin2js plugin, you could say

compileKotlin2Js {
    kotlinOptions.sourceMap = true
    kotlinOptions.moduleKind = 'commonjs'

However, with org.jetbrains.kotlin.js, you get Could not find method compileKotlin2Js-type errors.

Frustratingly, a lot of the documentation hasn’t been updated yet for the 1.3.40 move to the new plugin – the JS Modules page still describes the old syntax, and the Kotlin JavaScript tutorial hasn’t been updated since 2016.

Not exactly the answer to my question, but this works:

kotlin {
    target {

(useCommonJs source)