korlibs / korlibs/korge

Support npm transitive dependencies with esbuild

Open
#2,140 0 comments 0 reactions 0 assignees View on GitHub
bug check
Dominant language
Kotlin
Stars
3k
Forks
148
Avg merge
13h 44m
Merged PRs (30d)
1

Description

In the meantime this hack would do:

```kotlin
open class EsbuildCreateSymLink : DefaultTask() {
private val realNodeModules = File(project.buildDir, "js/node_modules")
private val linkNodeModulesProd = File(project.buildDir, "compileSync/js/main/productionExecutable/kotlin/node_modules")
private val linkNodeModulesDev = File(project.buildDir, "compileSync/js/main/developmentExecutable/kotlin/node_modules")

@TaskAction
fun run() {
for (linkNodeModules in listOf(linkNodeModulesProd, linkNodeModulesDev)) {
linkNodeModules.parentFile.mkdirs()
if (!Files.isSymbolicLink(linkNodeModules.toPath())) {
Files.createSymbolicLink(linkNodeModules.toPath(), realNodeModules.toPath())
}
}
}
}

tasks {
val esbuildCreateSymLink by creating(EsbuildCreateSymLink::class) {
dependsOn("kotlinNpmInstall")
}

val browserDebugEsbuild by getting {
dependsOn(esbuildCreateSymLink)
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how the Kotlin/Gradle build invokes esbuild and installs npm dependencies, using the EsbuildCreateSymLink task in the issue as the current workaround. Done means transitive npm dependencies are available to esbuild for production and development builds without requiring the symlink hack.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, kotlin
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.