Imagine I have made the kotlin/js libraries A, B and C.
A is used by B, and both A and B is used by C.
A exposes a function add(foo: String) that adds to a list.
B adds to the list and C adds to the list.
When C check the content of that list will B’s additions be included?
What you are asking is not related to the language itself but it’s a more wide problem called Transitive Dependencies
. Since Kotlin is built by Gradle (like 99% of the times) have a look on how Gradle handles transitive dependencies here
I found a bizarre bug with kotlin-js transitive dependencies by the way. If you have main
entry point in a project and in a dependent project. they will be both included. One start script will run after the other.
@lamba92
Yeah, I’ve had my share of experience with IVY so it’s not unknown territory
I guess I asked in case there were some oddities about this when dealing with javascript or kotlin/js.
I’ll delve into how Gradle go about this.
Actually, the problem is mainly that of the loader. In principle the javascript loading systems are designed to “isolate” libraries. As such multiple copies of a library could theoretically coexist. Loader systems such as requirejs don’t actually allow this (for good reasons) as multi-dependency can create all kinds of issues if library A includes libraries B and C and B and C each use a different version of library D (but A doesn’t expect that).