Hi!
I am trying to implement web workers in my KMP project and publish it to npm, but I am not sure how to do it.
js(IR) {
browser {
webpackTask(Action {
mainOutputFileName.set("js-worker.js")
})
@OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalDistributionDsl::class)
distribution(Action {
distributionName.set("jsWorker")
})
}
binaries.library()
binaries.executable()
}
I created another target for worker, so now I have 2.
val jsMain by getting {
resources.srcDirs("./build/jsWorker")
}
I also added the dependency for the jsWorker folder.
After build i can see that the js-worker.js file is generated in the
projectRoot/common/build
folder.
But I want to publish it to npm, so i need to use the
projectRoot/build
folder. Is it possible somehow to generate the js-worker.js file to the
projectRoot/build
folder? Because if my guess is correct, the worker file wont be included, when I publish the project to npm.