[Gradle, JS] Webpack devtool as a String

#KT-37635 fixed
This commit is contained in:
Ilya Goncharov
2020-03-20 12:37:27 +03:00
parent e951f1a43a
commit 5058c396c1
2 changed files with 6 additions and 6 deletions
@@ -130,7 +130,7 @@ open class KotlinWebpack : DefaultTask(), RequiresNpmDependencies {
var devServer: KotlinWebpackConfig.DevServer? = null var devServer: KotlinWebpackConfig.DevServer? = null
@Input @Input
var devtool: KotlinWebpackConfig.Devtool = KotlinWebpackConfig.Devtool.EVAL_SOURCE_MAP var devtool: String = KotlinWebpackConfig.Devtool.EVAL_SOURCE_MAP
private fun createRunner() = KotlinWebpackRunner( private fun createRunner() = KotlinWebpackRunner(
compilation.npmProject, compilation.npmProject,
@@ -27,7 +27,7 @@ data class KotlinWebpackConfig(
val bundleAnalyzerReportDir: File? = null, val bundleAnalyzerReportDir: File? = null,
val reportEvaluatedConfigFile: File? = null, val reportEvaluatedConfigFile: File? = null,
val devServer: DevServer? = null, val devServer: DevServer? = null,
val devtool: Devtool? = Devtool.EVAL_SOURCE_MAP, val devtool: String? = Devtool.EVAL_SOURCE_MAP,
val showProgress: Boolean = false, val showProgress: Boolean = false,
val sourceMaps: Boolean = false, val sourceMaps: Boolean = false,
val export: Boolean = true, val export: Boolean = true,
@@ -79,9 +79,9 @@ data class KotlinWebpackConfig(
val contentBase: List<String> val contentBase: List<String>
) : Serializable ) : Serializable
enum class Devtool(val code: String) { object Devtool {
EVAL_SOURCE_MAP("eval-source-map"), val EVAL_SOURCE_MAP = "eval-source-map"
SOURCE_MAP("source-map") val SOURCE_MAP = "source-map"
} }
fun save(configFile: File) { fun save(configFile: File) {
@@ -199,7 +199,7 @@ data class KotlinWebpackConfig(
use: ["kotlin-source-map-loader"], use: ["kotlin-source-map-loader"],
enforce: "pre" enforce: "pre"
}); });
config.devtool = ${devtool?.code?.let { "'$it'" } ?: false}; config.devtool = ${devtool?.let { "'$it'" } ?: false};
""".trimIndent() """.trimIndent()
) )