npm

abstract fun npm(name: String, version: String): Dependency

Creates a dependency on the NPM module.

Note: The created dependency should be manually added to this entity using other methods from this DSL:

kotlin.sourceSets["jsMain"].dependencies {
implementation(npm("is-odd-even", "1.0.0"))
}

This is only relevant for Kotlin entities that target only KotlinPlatformType.js or KotlinPlatformType.wasm.

Parameters

name

The NPM dependency name

version

The NPM dependency version


abstract fun npm(name: String, directory: File): Dependency

Creates a dependency on the NPM module.

Note: The created dependency should be manually added to this entity using other methods from this DSL:

kotlin.sourceSets["jsMain"].dependencies {
implementation(npm("is-odd-even", project.file("npm/is-odd-even")))
}

This is only relevant for Kotlin entities that target only KotlinPlatformType.js or KotlinPlatformType.wasm.

Parameters

name

The NPM dependency name

directory

The directory where dependency files are located (See NPM directory keyword)


abstract fun npm(directory: File): Dependency

Creates a dependency on the NPM module. The name of the dependency is derived either from the package.json file located in the directory or the directory name itself.

Note: The created dependency should be manually added to this entity using other methods from this DSL:

kotlin.sourceSets["jsMain"].dependencies {
implementation(npm(project.file("npm/is-odd-even")))
}

This is only relevant for Kotlin entities that target only KotlinPlatformType.js or KotlinPlatformType.wasm.

Parameters

directory

The directory where dependency files are located (See NPM directory keyword)