Kotlin JavaScript Gradle Plugin: Scoped Package Name

How can I set the npm package scope using the kotlin-gradle-plugin?

Looking at PackageJson.kt in kotlin-gradle-pluing I can see that npm scoped package names seem to be supported:

companion object {
    fun scopedName(name: String): ScopedName = if (name.contains("/")) ScopedName(
        scope = name.substringBeforeLast("/").removePrefix("@"),
        name = name.substringAfterLast("/")
    ) else ScopedName(scope = null, name = name)

    operator fun invoke(scope: String, name: String, version: String) =
        PackageJson(ScopedName(scope, name).toString(), version)

Then in NpmProjectVisitor.kt I find that the name in package.json is set by using the name of the npm project:

val name = npmProject.name
val packageJson = PackageJson(

And finally in NpmProject.kt I see how the npm project name is constructed based on the gradle project name:

private fun buildNpmProjectName(): String {
    val project = target.project
    val name = StringBuilder()


    if (project != project.rootProject) {

    if (target.name.isNotEmpty() && target.name.toLowerCase() != "js") {

    if (compilation.name != KotlinCompilation.MAIN_COMPILATION_NAME) {

    return name.toString()

Unfortunately it is not allowed to include slashes (’/’) in gradle project names. So setting @myscope/myproject is not an option.

Looks like this is not implemented yet, see https://youtrack.jetbrains.com/issue/KT-25878#focus=streamItem-27-2999812.0-0