How can we control the library name in a gradle mu...
# javascript
p
How can we control the library name in a gradle multi-project, kotlin/js project? Currently, if we run jsBrowserProductionLibraryDistribution inside a submodule, the project will create a library named as such: ParentModule-child-module So, if in our root project’s settings.gradle we have:
_rootProject_._name_ = "FooLibrary"
and then we have a submodule named:
bar-module
Gradle will always build the js library as
FooLibrary-bar-module
. This will be the filename of .js, .d.ts, and .js.map files, and it will also be the naming used inside the .js and .d.ts code. I would think the following, written inside `bar-module`’s build.gradle, would allow me to change the outputted library name, but it has no effect:
Copy code
kotlin{
    js(IR) {
        browser {
            distribution {
                name = "CustomLibraryName"
            }
            binaries.library()
        }
    }
}
I’m currently consuming this generated javascript library inside a flutter/dart project using dart’s js interop feature, and the hyphens included in the library name is causing a lot of grief. Renaming the the library files as well as all references within the js libraries code solves my issue, but it’s tedious to do on every build, so I’m hoping there’s a property within gradle that will allow me to explicitly name my generated libraries…
p
Excellent. Thanks Jake.