Skip to content

Comments

resources demo js workaround#2614

Open
dima-avdeev-jb wants to merge 1 commit intomasterfrom
dima-avdeev/resources-demo-js-workaround
Open

resources demo js workaround#2614
dima-avdeev-jb wants to merge 1 commit intomasterfrom
dima-avdeev/resources-demo-js-workaround

Conversation

@dima-avdeev-jb
Copy link
Contributor

No description provided.

@dima-avdeev-jb dima-avdeev-jb requested a review from pjBooms January 9, 2023 18:19
@eymar
Copy link
Member

eymar commented Feb 24, 2023

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.

@dima-avdeev-jb
Copy link
Contributor Author

dima-avdeev-jb commented Feb 24, 2023

@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.

@eymar
Copy link
Member

eymar commented Feb 24, 2023

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.

@dima-avdeev-jb
Copy link
Contributor Author

@eymar
I think we can postpone current PR after Kotlin Conf.

@eymar
Copy link
Member

eymar commented Feb 24, 2023

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)
}

pjBooms added a commit that referenced this pull request Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants