[Gradle, JS] Webpack catch files from js compilations

This commit is contained in:
Ilya Goncharov
2019-12-27 19:02:45 +03:00
parent d827f9b040
commit 9c89859c67
2 changed files with 16 additions and 1 deletions
@@ -94,6 +94,11 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
it.bin = "webpack-dev-server/bin/webpack-dev-server.js"
it.compilation = compilation
it.entry = getByKind(
kind,
compilation.productionLinkTask.outputFile,
compilation.developmentLinkTask.outputFile
)
it.description = "start ${kind.name.toLowerCase()} webpack dev server"
it.devServer = KotlinWebpackConfig.DevServer(
@@ -162,6 +167,11 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
it.configureOptimization(kind)
it.compilation = compilation
it.entry = getByKind(
kind,
compilation.productionLinkTask.outputFile,
compilation.developmentLinkTask.outputFile
)
it.description = "build webpack ${kind.name.toLowerCase()} bundle"
it.destinationDirectory = distribution.directory
@@ -49,7 +49,12 @@ abstract class KotlinJsIrSubTarget(
target.compilations.all {
val npmProject = it.npmProject
it.compileKotlinTask.kotlinOptions.outputFile = npmProject.dir.resolve(npmProject.main).canonicalPath
listOf(
it.productionLinkTask,
it.developmentLinkTask
).forEach { task ->
task.kotlinOptions.outputFile = npmProject.dir.resolve(npmProject.main).canonicalPath
}
}
}