Hello Community,
I am working on a Kotlin Multiplatform project and aiming to disable source map generation for the JavaScript (JS) library. Despite configuring my build.gradle.kts
file as shown below, source maps are still being generated:
js(IR) {
binaries.library()
generateTypeScriptDefinitions()
browser {
commonWebpackConfig(Action {
sourceMaps = false // point 1
})
webpackTask(Action {
sourceMaps = false // point 2
})
}
}
However, when I modify the configuration to the following, it starts to work, and source maps are no longer generated:
js(IR) {
binaries.library()
generateTypeScriptDefinitions()
browser {
}
binaries.withType<JsIrBinary>().all {
this.linkTask.configure {
kotlinOptions {
sourceMap = false
}
}
}
}
Upon debugging, I noticed that the configurations at point 1 and point 2 are only invoked once by the Karma test configuration. and yes everything works if i am changing binaries.library() to binaries.executable()
Could anyone help me understand why the initial setup with commonWebpackConfig
and webpackTask
does not disable the source map generation as expected? Additionally, why does the alternative approach successfully disable it? Any insights or explanations would be greatly appreciated.