I noticed this `// Serve sources to debug inside b...
# compose-web
a
I noticed this
// 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?
Copy code
@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()
    }
j
Maybe not relevant to your scenario but just in case it may be: I've assumed it is, based on that
dev
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)
b
*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.
(cc @Ilya Goncharov [JB] just in case)