Alex Styl
04/03/2025, 2:07 AM// Serve sources to debug inside browser
in the kmp wizard.
Is the devServer only available in deb builds? Is it safe to assume that webBrowserDistribution
doesnt include it?
@OptIn(ExperimentalWasmDsl::class)
wasmJs("web") {
moduleName = "composeApp"
browser {
val rootDirPath = project.rootDir.path
val projectDirPath = project.projectDir.path
commonWebpackConfig {
outputFileName = "composeApp.js"
devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply {
static = (static ?: mutableListOf()).apply {
// Serve sources to debug inside browser
add(rootDirPath)
add(projectDirPath)
}
}
}
}
binaries.executable()
}
Jacob Ras
04/03/2025, 7:57 AMdev
name, so for my project where I need to host the web app locally I'm using Ktor to serve the distribution, through a staticFiles()
route (https://ktor.io/docs/server-static-content.html#folders)bashor
04/04/2025, 4:45 PM*Distribution
tasks puts compilation output (after wabpack & binaryen) without sources to one place under the dist
folder.
Webpack devServer is used in in *Run
tasks where it serves compilation output by default. In this case it also configured to serve source files.
⚠️ Webpack devServer and *Run
tasks are not intended to be used as a production server. They should be used only for development.bashor
04/04/2025, 4:46 PM