https://kotlinlang.org logo
#javascript
Title
# javascript
h

handstandsam

09/26/2023, 3:54 AM
There is an amazing article and code that use 2 separate JS targets, one for "frontend" and one for "worker". I followed this pattern and got it set up. However, as I made changes to the "worker", it was not getting re-compiled correct. In the article it does 2 things that seem to try account for this: 1.
tasks["frontendProcessResources"].dependsOn.add("workerBrowserDistribution")
2.
Copy code
val frontendMain by getting {
  resources.srcDirs("./build/worker")
}
My question: What is the most up to date configuration and tasks that will allow me to make changes to either "worker" or "frontend" and be able to have it continually reflect changes in the browser?
My current gradle config
j

jw

09/26/2023, 4:00 AM
You definitely don't want either of those existing suggestions long term. Basically the opposite of the correct thing to do.
You need to find the task which produces the worker file and add it as a source directory to the frontend resources.
You can add a task as a source directory and Gradle will auto-wire the output and the task dependency correctly.
👍 2
h

handstandsam

09/26/2023, 12:22 PM
Thank you. This project was using Gradle 7.5.1 and didn't have that message. After upgrading to 8.3 it had really clear messaging on how to do that. Thanks for pointing me in the right direction
a

apatrida

10/18/2023, 1:23 PM
Do you mind posting the updated Gradle file when you have it working, then the solution is here along with the conversation.
h

handstandsam

10/18/2023, 1:25 PM
With Gradle 8.3 it provides a message to you letting you know about conflicting inputs and outputs. I don't have the exact messages anymore, but Gradle will tell you if there is an issue.
a

apatrida

10/18/2023, 8:33 PM
thanks
👍 1