# How to configure new KotlinJS plugin?

**URL:** <https://discuss.kotlinlang.org/t/how-to-configure-new-kotlinjs-plugin/14105>\
**Category:** Support\
**Created:** [August 31, 2019, 5:16pm UTC](https://discuss.kotlinlang.org/t/how-to-configure-new-kotlinjs-plugin/14105 "2019-08-31T17:16:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nanodeath](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/nanodeath/32/1803_2.png) [@nanodeath](https://discuss.kotlinlang.org/u/nanodeath)\
**Post date:** [August 31, 2019, 5:16pm UTC](https://discuss.kotlinlang.org/t/how-to-configure-new-kotlinjs-plugin/14105/1 "2019-08-31T17:16:25Z")

</div>

With the old `kotlin2js` plugin, you could say

```auto
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](https://kotlinlang.org/docs/reference/js-modules.html#from-gradle) page still describes the old syntax, and the [Kotlin JavaScript tutorial](https://kotlinlang.org/docs/tutorials/javascript/getting-started-gradle/getting-started-with-gradle.html) hasn’t been updated since 2016.

---

<div class="post-metadata">

**Author:** ![nanodeath](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/nanodeath/32/1803_2.png) [@nanodeath](https://discuss.kotlinlang.org/u/nanodeath)\
**Post date:** [August 31, 2019, 11:43pm UTC](https://discuss.kotlinlang.org/t/how-to-configure-new-kotlinjs-plugin/14105/2 "2019-08-31T23:43:36Z")

</div>

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

```auto
kotlin {
    target {
        useCommonJs()
        browser()
    }
}

```

([useCommonJs](https://github.com/JetBrains/kotlin/blob/4a8dbeda1b86be780ff43e3650f8bfe1d0909bc9/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/KotlinJsTarget.kt#L59) source)
