Ryan
05/24/2024, 1:45 PMUncaught (in promise) LinkError: WebAssembly.instantiate(): Import #25 module="js_code" function="kotlin.wasm.internal.instanceOf": function import requires a callable
Igor Yakovlev
05/24/2024, 2:06 PMRyan
05/24/2024, 2:12 PMcomposeApp.uninstantiated.mjs
Igor Yakovlev
05/24/2024, 2:14 PMcomposeApp.uninstantiated.mjs
for the kotlin.wasm.internal.instanceOf
field in js_code
objectRyan
05/24/2024, 2:22 PMRyan
05/24/2024, 2:24 PMwasmJsBrowserDistribution
to generate the filesRyan
05/24/2024, 3:53 PMRok Oblak
06/16/2024, 9:26 AMwasmJsBrowserProductionRun
(or wasmJsBrowserProductionWebpack
), any external function call throws this error.
Clean build fixes it, but I feel like this is an issue that should be resolved in the gradle task itself (and probably without doing the entire clean?).
Minimal reproducible scenario:
1. create a new fresh CMP project from the wizard
2. create a regular (non-production) browser run first
3. then create a production run (or deploy a production webpack to a site)
Code:
@OptIn(ExperimentalComposeUiApi::class)
fun main() {
ComposeViewport(document.body!!) {
val currentPath = window.location.pathname // This crashes
Text("current path: $currentPath")
}
}
I searched but didn't see an issue created yet.Svyatoslav Kuzmich [JB]
06/16/2024, 10:53 AMRok Oblak
06/16/2024, 10:59 AMval test = window.document.body?.toString()
Text("Test: $test")
and first do dev run, then start a production run, then I see:
And after that again if I clean first, it works.
Chrome, Mac 14.4.1Svyatoslav Kuzmich [JB]
06/16/2024, 11:04 AMdewildte
06/16/2024, 1:50 PMSvyatoslav Kuzmich [JB]
06/17/2024, 8:22 AM