Robert Jaros
03/14/2024, 1:27 PMwebpack.config.d
so probably I can create a custom gradle task to do the same, but is there any other option?Edoardo Luppi
03/14/2024, 1:50 PMRobert Jaros
03/14/2024, 2:33 PMwebpack.config.d
configuration for webpack.Edoardo Luppi
03/14/2024, 2:37 PMnodejs
configuration does not use Webpack btw.
You can target node by having two compilations with browser
and changing webpackTask.configFile
depending on which one is running.Edoardo Luppi
03/14/2024, 2:38 PMRobert Jaros
03/14/2024, 2:50 PMDeclaring multiple Kotlin Targets of the same type is not recommended
and will become an error in the upcoming Kotlin releases.
Edoardo Luppi
03/14/2024, 2:50 PMEdoardo Luppi
03/14/2024, 2:51 PMRobert Jaros
03/14/2024, 2:52 PMEdoardo Luppi
03/14/2024, 2:53 PMEdoardo Luppi
03/14/2024, 2:54 PMturansky
03/14/2024, 2:55 PMturansky
03/14/2024, 2:55 PMturansky
03/14/2024, 2:56 PMRobert Jaros
03/14/2024, 2:58 PMturansky
03/14/2024, 3:04 PMkfc-plugins
😞turansky
03/14/2024, 3:08 PMapp\ (klib-only? js-only?)
app-browser\ (bundling-only)
webpack.config.d\
app-node\ (bundling-only)
webpack.config.d\
Edoardo Luppi
03/14/2024, 3:11 PM-Ptarget=node/browser
and then having
browser {
webpackTask {
configFile = if (isBrowserTarget) ... else ...
}
}
doesn't look wrong. You'll also have to change the distribution output.Robert Jaros
03/14/2024, 3:13 PMEdoardo Luppi
03/14/2024, 3:13 PMbuild both bundles at the same timeI don't think there is a way to have them built at the same time (with the same command)
Edoardo Luppi
03/14/2024, 3:15 PMturansky
03/14/2024, 3:18 PMRobert Jaros
03/14/2024, 3:43 PMindex.html
) are copied by productionWebpack
task. I changed the options in webpackTask {}
block, and js files are put where I want them, but the resources still go to dist/js/productionExecutable
.Edoardo Luppi
03/14/2024, 4:25 PMRobert Jaros
03/14/2024, 4:26 PMgetByName("jsBrowserProductionExecutableDistributeResources", Copy::class).apply {
destinationDir = file("build/dist/something/productionExecutable")
}
Robert Jaros
03/14/2024, 4:27 PMjs
directoryRobert Jaros
03/15/2024, 9:58 AMval jsBrowserProductionExecutableDistributeResources = tasks.getByName("jsBrowserProductionExecutableDistributeResources", Copy::class)
tasks.register("jsBrowserProductionExecutableDistributeResourcesSSR", Copy::class) {
from(jsBrowserProductionExecutableDistributeResources.source)
into("build/dist/js.ssr/productionExecutable")
}
val kotlinWebpackJs = tasks.getByName("jsBrowserProductionWebpack", KotlinWebpack::class)
tasks.register("jsBrowserProductionWebpackSSR", KotlinWebpack::class, kotlinWebpackJs.compilation, project.objects)
tasks.getByName("jsBrowserProductionWebpackSSR", KotlinWebpack::class).apply {
dependsOn("jsBrowserProductionExecutableDistributeResourcesSSR", "jsProductionExecutableCompileSync")
mode = KotlinWebpackConfig.Mode.PRODUCTION
inputFilesDirectory.set(kotlinWebpackJs.inputFilesDirectory.get())
entryModuleName.set(kotlinWebpackJs.entryModuleName.get())
esModules.set(kotlinWebpackJs.esModules.get())
outputDirectory.set(file("build/dist/js.ssr/productionExecutable"))
mainOutputFileName.set("main.bundle.js")
this.webpackConfigApplier {
configDirectory = file("webpack.config.ssr.d")
}
}
Edoardo Luppi
03/15/2024, 10:14 AM