Hello! I’m trying to debug in browser my `wasmJsMa...
# webassembly
g
Hello! I’m trying to debug in browser my
wasmJsMain
and I have the following project structure: • Project ◦ browserApp ◦ shared ◦ shared-ui
Copy code
commonWebpackConfig {
        outputFileName = "browserApp.js"
        devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply {
            static = (static ?: mutableListOf()).apply {
                add(project.projectDir.path)
                add(project(":shared").projectDir.path)
                add(project(":shared-ui").projectDir.path)
            }
        }
    }
}
It only works for
browserApp
module, remaining files will throw:
Could not load content for <http://localhost:8080/shared/src/commonMain/>.... (HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE)
Whats missing? 🤔
a
Could you please try add something like this and check if it works:
Copy code
add(project.rootDir.path)
g
I’ve tried that too and it doesn’t work 😞
Hum… strange if I have:
Copy code
add(project.rootDir.path)
add(project.projectDir.path)
it works for all modules, but if I add only:
Copy code
add(project.rootDir.path)
it works just for the other modules. Is it suppose to? 🤔
a
It could be that for the executable module all the paths look like
src/../../
instead of
browserApp/src/../../
So, yes, it seems like that it works as expected
So, yep, just use those two paths.
g
Ok thanks 😊
one more: it debugs on Chrome but not on Firefox, it ignores break points
Should I open an issue or it’s a known issue?
a
It's known issue and the problem is on the Firefox side. You can track it here: https://bugzilla.mozilla.org/show_bug.cgi?id=1871403
👍 2
g
Thanks once again 😉
kodee welcoming 1
a
@Artem Kobzar I also stumbled on this issue. I started with a fresh project generated by Kotlin Multiplatform Wizard and followed instruction in article Debug Kotlin/Wasm code to add
Copy code
add(project.projectDir.path + "/commonMain/")
        add(project.projectDir.path + "/wasmJsMain/")
but it’s not working. While
Copy code
add(project.rootDir.path)
add(project.projectDir.path)
works.
a
@Andraz thank you so much for sharing it. We will fix it in our tutorial and will add the snippet to the KMP wizard.
🙌 1