(Beginner here) with Kotlin 1.3.70 I am getting: ...
# javascript
n
(Beginner here) with Kotlin 1.3.70 I am getting:
Copy code
> Task :main-presenter:processDceJsKotlinJs FAILED
error: duplicate target file will be created for '/home/niqo/workspace/source/social-cats/auth/client/build/libs/auth-client-js-0.1.0-SNAPSHOT.jar!social-cats-playground-client.js' and '/home/niqo/workspace/source/social-cats/session/client/build/libs/session-js-0.1.0-SNAPSHOT.jar!social-cats-playground-client.js'
Any tips on how to understand this issue and fix it ?
i
The main problem in current DCE is that it produces js files with original names, but it puts it in flat list on one directory. So if you have similar file names as input for dce, it produces errors You can disable DCE, and use
browserDevelopmentWebpack
for your build
Copy code
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig.Mode
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig.Devtool
...
kotlin {
 target {
  browser {
   webpackTask {
    mode = Mode.PRODUCTION
    devtool = Devtool.SOURCE_MAP
   }
  }
 }
}

tasks.named("assemble") {
 dependsOn.remove("browserProductionWebpack")
 dependsOn("browserDevelopmentWebpack")
}
n
Thanks @Ilya Goncharov [JB] I also found a youtrack issue discussing this -> https://youtrack.jetbrains.com/issue/KT-32209#focus=streamItem-27-3592848.0-0
i
Honestly, this issue will be more relevant https://youtrack.jetbrains.com/issue/KT-35855 Although your issue is about one of possible solution of real problem, 35855 is about real problem at all
👍 1
d
@Ilya Goncharov [JB] I have tried to remove the task as suggested. However I am using Gradle 6.2.2 and get the following error:
Removing a task dependency from a task instance is not supported.
Is there an alternative approach? I'm really stuck at the moment.
I had to do this instead:
Copy code
tasks.getByName("processDceKotlinJs").enabled=false