I stumbled across following problem: i get a `Long...
# javascript
t
I stumbled across following problem: i get a
Long
value from the klock-library. Unfortunately klock-js brings its own kotlin.js library hence the
Kotlin.Long
returned by klock is not the same
Kotlin.Long
the rest of the application uses. Is there a way to exclude klock's dependency on kotlin?
r
Doesn’t deleting klock’s
kotlin.js
help?
t
yes, but on the one hand i don't think deleting transitive dependencies is good idea, on the other hand i wasn't able to do that, yet. @Ilya Goncharov [JB] handed me some gradle code to delete klock-dependencies:
Copy code
tasks.getByName("kotlinNpmInstall") {
    doLast {
        File("$buildDir/js/node_modules/klock-root-klock/node_modules").deleteRecursively()
    }
}
But unfortunately that doesn't work in my main project as this task doesn't exist - and i couldn;t fgure out yet, whats the correct one
i
@thana I thought, that better is to delete only
node_modules/kotlin
for reliability (maybe in future there are other klock’s dependencies) It needs to investigate, but seems that kotlin shouldn’t be transitive dependency at all So you can use it untill klock fix its npm kotlin dependency
Copy code
tasks.getByName("kotlinNpmInstall") {
    doLast {
        File("$buildDir/js/node_modules/klock-root-klock/node_modules/kotlin").deleteRecursively()
    }
}
t
yes in fact i was thinking about amending the code pretty much that way - yet the task koitlinNpmInstall doesn't seem to exist 😕
in fact there is no task with "npm" in its name 😞
i
It is very strange, without it, nodejs tests shouldn’t work If you are sure that everything ok with it, you can set
doFirst
trigger on your
jsNodeTest
Copy code
tasks.getByName("jsNodeTest") {
    doFirst {
        File("$buildDir/js/node_modules/klock-root-klock/node_modules").deleteRecursively()
    }
}
But I would like to understand, why you have not
kotlinNpmInstall
task
t
yea i loved to find that out, too, because in my small test-project it does exist and both projects use kotlin 1.3.60 and MPP
@Ilya Goncharov [JB] btw i found out why the task
kotlinNpmInstall
does not exist: it exists on the root project only - but i have a multi (gradle-)module project. Also i have to delete the js files from the
$buildDir
of the root module. now it works :-)
yet very confusing: i have to put the code into the
afterEvaluate
blockl inside the
submodules
block referencing the
rootProject
again. putting it on the root project directly doesn't work 🤷‍♂️