npmDev

abstract fun npmDev(name: String, version: String)

Declares a dependency on a NPM module that is added to devDependencies.

NPM dev dependencies should not be applied to Gradle dependency scopes such as api, implementation, and so on. Calling npmDev will automatically add it to the enclosing dependency collector.

kotlin.sourceSets["jsMain"].dependencies {
npmDev("is-odd-even", "^1.1.0")
}

The version will be parsed by node-semver. See the node-semver README for the supported syntax.

Creating NPM dependencies is only relevant for Kotlin entities that target JS or WasmJS.

Parameters

name

The NPM dependency name

version

The NPM dependency version


abstract fun npmDev(name: String, version: Provider<String>)

Declares a dependency on a NPM module that is added to devDependencies.

NPM dev dependencies should not be applied to Gradle dependency scopes such as api, implementation, and so on. Calling npmDev will automatically add it to the enclosing dependency collector.

version is resolved lazily, so it may be provided by a value that is not yet known when the declaration is made:

kotlin.sourceSets["jsMain"].dependencies {
npmDev(
"is-odd-even",
project.providers.gradleProperty("isOddEvenVersion"),
)
}

If version has no value, then the build fails when the declaration is used.

The version will be parsed by node-semver. See the node-semver README for the supported syntax.

Creating NPM dependencies is only relevant for Kotlin entities that target JS or WasmJS.

Parameters

name

The NPM dependency name

version

The provider of the NPM dependency version


abstract fun npmDev(name: String, directory: File)

Declares a dependency on a NPM module located in a local directory that is added to devDependencies.

NPM dev dependencies should not be applied to Gradle dependency scopes such as api, implementation, and so on. Calling npmDev will automatically add it to the enclosing dependency collector.

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

The dependency is declared with the NPM local path notation using the absolute path of the directory.

Creating NPM dependencies is only relevant for Kotlin entities that target JS or WasmJS.

Parameters

name

The NPM dependency name

directory

The directory where dependency files are located