resources demo js workaround
I asked about the issue with resources in different modules in k/js. It's a known thing, but no official solution available yet. This workaround is a valid thing to do. I took it for Compose k/wasm experiments. So it's okay to merge in my opinion.
@eymar For now, JS resources work fine if JS app "executable" is specified in shared module. So, maybe this PR is redundant.
./gradlew :resources:demo:shared:jsBrowserDevelopmentRun - works fine.
That's right. This workaround will be needed if we have many modules with different resources and all of them need to be included in the final distribution. So if we keep the "executable" JS in the same module where we keep the resources, then it's fine and workaround is not needed indeed.
@eymar I think we can postpone current PR after Kotlin Conf.
Yeah, not urgent.
Just some notes for the time we decided to get back to it: demo/jsMain/resources contains the copy of resources, so it would work even without a workaround in this PR.
So I changed it a bit in my branch to make it work:
val copyResources = tasks.create("copyJsResourcesWorkaround", Copy::class.java) {
from(project(":resources:demo:shared").file("src/commonMain/resources"))
into("build/processedResources/js/main")
}
afterEvaluate {
project.tasks.getByName("jsProcessResources").finalizedBy(copyResources)
}