Is it possible to configure webpack (eg. dev serve...
# javascript
p
Is it possible to configure webpack (eg. dev server port) in kotlin-js plugin as in kotlin-frontend-plugin?
b
cc @Ilya Goncharov [JB]
i
It is possible to declare it with
webpack.config.d
You can create js file in it with content smth like
Copy code
config.devServer = config.devServer || {}
config.devServer.port = ...
r
You can configure port and some other options with gradle DSL:
Copy code
runTask {
                outputFileName = "main.bundle.js"
                devServer = KotlinWebpackConfig.DevServer(
                    open = false,
                    port = 3000,
                    contentBase = listOf("$buildDir/processedResources/frontend/main")
                )
            }
and other parameters with
webpack.config.d
p
so in build.gradle it should be
Copy code
kotlin {
  js {
    browser {
       runTask ...
}
?
webpack.config.d
approach is a bit too low, maybe for webdevs, not kotlin programmers, that were promised that webpack is managed by plugin 😉
and
8080
as default is a bit too agressive I think 😉
for backend dev
i
Like @Robert Jaros told, you can configure it via
Copy code
kotlin {
  js {
    browser {
       runTask {
           devServer = KotlinWebpackConfig.DevServer(
               port = 3000,
               contentBase = listOf("$buildDir/processedResources/frontend/main"
           )
       }
}
But in case with
webpack.config.d
you do stuff via low level js config, but don’t need to overwrite
contentBase
property We think about how to do good DX with gradle plugin for this purposes.
👍 1
p
not a gradle expert, how can I find the config path in plugins' source code?
org.jetbrains.kotlin.gradle.targets.js.dsl
?
i
org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
if it is what you want
👍 1