Gradle, js, browser: fix run
This commit is contained in:
-7
@@ -29,17 +29,10 @@ open class NodeJsExec : AbstractExecTask<NodeJsExec>(NodeJsExec::class.java) {
|
||||
args("--require", moduleName)
|
||||
}
|
||||
|
||||
fun requireSourceMapSupport() {
|
||||
require("kotlin-test-nodejs-runner/kotlin-nodejs-source-map-support.js")
|
||||
}
|
||||
|
||||
fun script(file: File) {
|
||||
check(script == null) {
|
||||
"Script was already set to $script"
|
||||
}
|
||||
script = file.canonicalFile.relativeToOrSelf(npmProject.nodeWorkDir).path
|
||||
}
|
||||
|
||||
fun compileOutput(compilationTask: Kotlin2JsCompile) =
|
||||
script(npmProject.compileOutput(compilationTask))
|
||||
}
|
||||
+7
-3
@@ -53,14 +53,18 @@ class KotlinBrowserJs(target: KotlinJsTarget) :
|
||||
|
||||
project.createOrRegisterTask<KotlinWebpack>(disambiguateCamelCased("run")) {
|
||||
val compileKotlinTask = compilation.compileKotlinTask
|
||||
it.dependsOn(target.npmResolveTaskHolder.getTaskOrProvider(), compileKotlinTask)
|
||||
it.dependsOn(
|
||||
target.npmResolveTaskHolder.getTaskOrProvider(),
|
||||
compileKotlinTask,
|
||||
project.getTasksByName(compilation.processResourcesTaskName, false)
|
||||
)
|
||||
|
||||
it.bin = "webpack-dev-server"
|
||||
it.entry = npmProject.compileOutput(compileKotlinTask)
|
||||
|
||||
val projectDir = target.project.projectDir.canonicalPath
|
||||
it.devServer = KotlinWebpackConfig.DevServer(
|
||||
contentBase = listOf("$projectDir/src/main/resources")
|
||||
open = true,
|
||||
contentBase = listOf(compilation.output.resourcesDir.canonicalPath)
|
||||
)
|
||||
|
||||
it.outputs.upToDateWhen { false }
|
||||
|
||||
Reference in New Issue
Block a user