Windows source-map-loading with absolute paths
This commit is contained in:
+12
-2
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
|
||||
import org.jetbrains.kotlin.gradle.targets.js.npm.npmProject
|
||||
import org.jetbrains.kotlin.gradle.targets.js.testing.*
|
||||
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
|
||||
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig.Devtool
|
||||
import org.jetbrains.kotlin.gradle.testing.internal.reportsDir
|
||||
import org.slf4j.Logger
|
||||
import java.io.File
|
||||
@@ -150,7 +149,7 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) : KotlinJsTestF
|
||||
val webpackConfigWriter = KotlinWebpackConfig(
|
||||
configDirectory = project.projectDir.resolve("webpack.config.d").takeIf { it.isDirectory },
|
||||
sourceMaps = true,
|
||||
devtool = Devtool.INLINE_SOURCE_MAP,
|
||||
devtool = null,
|
||||
export = false,
|
||||
progressReporter = true,
|
||||
progressReporterPathFilter = nodeJs.rootPackageDir.absolutePath
|
||||
@@ -164,6 +163,17 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) : KotlinJsTestF
|
||||
it.appendln("function createWebpackConfig() {")
|
||||
|
||||
webpackConfigWriter.appendTo(it)
|
||||
//language=ES6
|
||||
it.appendln(
|
||||
"""
|
||||
(function() {
|
||||
const webpack = require('webpack');
|
||||
config.plugins.push(new webpack.SourceMapDevToolPlugin({
|
||||
moduleFilenameTemplate: "[absolute-resource-path]"
|
||||
}))
|
||||
})();
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
it.appendln(" return config;")
|
||||
it.appendln("}")
|
||||
|
||||
+3
-4
@@ -26,7 +26,7 @@ data class KotlinWebpackConfig(
|
||||
val bundleAnalyzerReportDir: File? = null,
|
||||
val reportEvaluatedConfigFile: File? = null,
|
||||
val devServer: DevServer? = null,
|
||||
val devtool: Devtool = Devtool.EVAL_SOURCE_MAP,
|
||||
val devtool: Devtool? = Devtool.EVAL_SOURCE_MAP,
|
||||
val showProgress: Boolean = false,
|
||||
val sourceMaps: Boolean = false,
|
||||
val export: Boolean = true,
|
||||
@@ -79,8 +79,7 @@ data class KotlinWebpackConfig(
|
||||
|
||||
enum class Devtool(val code: String) {
|
||||
EVAL_SOURCE_MAP("eval-source-map"),
|
||||
SOURCE_MAP("source-map"),
|
||||
INLINE_SOURCE_MAP("inline-source-map")
|
||||
SOURCE_MAP("source-map")
|
||||
}
|
||||
|
||||
fun save(configFile: File) {
|
||||
@@ -197,7 +196,7 @@ data class KotlinWebpackConfig(
|
||||
use: ["kotlin-source-map-loader"],
|
||||
enforce: "pre"
|
||||
});
|
||||
config.devtool = '${devtool.code}';
|
||||
config.devtool = ${devtool?.code?.let { "'$it'" } ?: false};
|
||||
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user