suresh
02/18/2024, 10:07 PMsuresh
02/18/2024, 10:08 PMUncaught (in promise) TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.
suresh
02/18/2024, 10:08 PMsuresh
02/18/2024, 10:12 PMArtem Kobzar
02/18/2024, 10:19 PMsuresh
02/18/2024, 10:21 PMfun Route.webApp() {
webApp("/app", "app")
}
fun Route.webApp(remotePath: String, basePackage: String) {
staticResources(remotePath, basePackage) {
exclude { it.path.endsWith(".log") }
default("index.html")
modify { url, call ->
when (call.request.path()) {
remotePath -> call.respondRedirect("$remotePath/")
}
}
}
}
suresh
02/18/2024, 10:24 PMArtem Kobzar
02/18/2024, 10:24 PMsuresh
02/18/2024, 10:35 PMContent-Type: text/html; charset=UTF-8
suresh
02/18/2024, 10:35 PMsuresh
02/18/2024, 10:40 PMfetch
for this wasm file as it’s loaded by the wrapper script.Artem Kobzar
02/18/2024, 10:54 PMapplication/wasm
Artem Kobzar
02/18/2024, 10:59 PMif (call.requrest.path().endsWith(".wasm")) {
call.response.header(HttpHeaders.ContentType, "application/wasm")
}
suresh
02/18/2024, 11:07 PMsuresh
02/19/2024, 12:17 AMwasmJsBrowserDistribution
suresh
02/19/2024, 12:44 AM2.0.0-Beta4
suresh
02/19/2024, 12:46 AM$ git clone <https://github.com/Kotlin/kotlin-wasm-examples>
$ cd browser-example
// change the plugin version to 2.0.0-Beta4
$ ./gradlew wasmJsBrowserDistribution
suresh
02/19/2024, 12:54 AMArtem Kobzar
02/19/2024, 8:43 AM