Hi. I have a KMP project with android/ios/js. What is the gradle task to export ALL (shared + js + d...
j
Hi. I have a KMP project with android/ios/js. What is the gradle task to export ALL (shared + js + dependencies) in one js file to use it in an electron app for example ? I don’t find much doc about that. We have tried build and jsBrowserDistribution but nothing seems to match what I need gradle js part
Copy code
js(IR) {
    browser {
        commonWebpackConfig {
            cssSupport.enabled = true
        }
        binaries.executable()
    }
}
a
change
binaries.executable()
to
binary.library()
and run the task
compileProductionLibraryKotlinJs
or just
build
g
We're generating our lib with
binaries.executable()
+
./gradlew jsBrowserDistribution jsPublicPackageJson
, I didn't even know about binary.library() . But then we need to copy the package.json from
build/tmp/jsPublicPackageJson/package.json
and then from the directory
build/js/packages/@...
we use npm publish. Hope it helps
j
Thanks for your answers, finally we have used
jsBrowserDistribution
a
You really don't need
binary.executable()
for libraries.
binaries.libraries()
together with https://github.com/mpetuska/npm-publish is all you need
👌 1
g
Thank you, I'll try that on my side, look like I was patching this on my side instead of using the right tools, thanks for sharing!