Orfeo Ciano
09/15/2024, 9:20 AM./gradlew run
command. All good.
So, I've then created my artifact with ./gradlew wasmJsBrowserDistribution
. I took the whole content of the productionExecutable
and uploaded to my webserver.
When I open the page, it looks like everything loads correctly, however, there is an issue with the WASM.
I have no clue how to troubleshoot/debug it ๐
Can someone help me out?Robert Jaros
09/15/2024, 9:23 AMOrfeo Ciano
09/15/2024, 9:29 AMdefault
:
[Exception: ReferenceError: Cannot access '__WEBPACK_DEFAULT_EXPORT__' before initialization at Module.default (webpack-internal:///./kotlin/composeApp.mjs:5:42) at Module.invokeGetter (<anonymous>:3:28) at <anonymous> at <http://raspberry/composeApp.js:167:33> at eval (webpack-internal:///./kotlin/composeApp.mjs:39:14)]
memory
:
[Exception: ReferenceError: Cannot access 'memory' before initialization at Module.memory (webpack-internal:///./kotlin/composeApp.mjs:6:53) at Module.invokeGetter (<anonymous>:3:28) at <anonymous> at <http://raspberry/composeApp.js:167:33> at eval (webpack-internal:///./kotlin/composeApp.mjs:39:14)]
_initialize
:
[Exception: ReferenceError: Cannot access '_initialize' before initialization at Module._initialize (webpack-internal:///./kotlin/composeApp.mjs:4:58) at Module.invokeGetter (<anonymous>:3:28) at <anonymous> at <http://raspberry/composeApp.js:167:33> at eval (webpack-internal:///./kotlin/composeApp.mjs:39:14)]
Robert Jaros
09/15/2024, 9:30 AMOrfeo Ciano
09/15/2024, 9:32 AMOrfeo Ciano
09/15/2024, 9:42 AMOrfeo Ciano
09/15/2024, 10:09 AMRobert Jaros
09/15/2024, 11:25 AMbuild
directory instead of only build/dist/wasmJs/productionExecutable
Orfeo Ciano
09/15/2024, 11:29 AMOrfeo Ciano
09/15/2024, 11:29 AMOrfeo Ciano
09/15/2024, 11:29 AMOrfeo Ciano
09/15/2024, 11:29 AMOrfeo Ciano
09/15/2024, 11:30 AMOrfeo Ciano
09/15/2024, 11:37 AMRobert Jaros
09/15/2024, 11:46 AMOrfeo Ciano
09/15/2024, 11:47 AMOrfeo Ciano
09/15/2024, 11:48 AMOrfeo Ciano
09/15/2024, 5:19 PMOrfeo Ciano
09/15/2024, 5:45 PMRobert Jaros
09/15/2024, 6:01 PMOrfeo Ciano
09/15/2024, 6:05 PM//ViewModel declaration
val chatModule = module {
viewModelOf(::ChatViewModel)
}
// Factories declarations
val repositoryModule = module {
factoryOf(::GenerateRepository)
factoryOf(::ChatRepository)
factoryOf(::ModelsRepository)
}
// Singleton declarations
val coreModule = module {
singleOf(::ThemeState)
singleOf(::ModelDownloadState)
}
The App initalization is done like this
KoinApplication(::koinConfiguration) {
val koin = getKoin()
// basic initialization
val themeState = koin.get<ThemeState>()
val preferences = koin.get<Preferences>()
//... MainScreen()
}
private fun koinConfiguration() = koinApplication {
modules(
coreModule,
networkModule,
repositoryModule,
mainModule,
onboardingModule,
chatModule,
modelsModule,
settingsModule,
)
}
And to complete I've got these dependencies
implementation(libs.koin.compose)
implementation(libs.koin.compose.viewmodel)
implementation(libs.koin.compose.viewmodel.navigation)
This is the toml
koin-compose = { group = "io.insert-koin", name = "koin-compose", version.ref = "koin" }
koin-compose-viewmodel = { group = "io.insert-koin", name = "koin-compose-viewmodel", version.ref = "koin" }
koin-compose-viewmodel-navigation = { group = "io.insert-koin", name = "koin-compose-viewmodel-navigation", version.ref = "koin" }
I've been able to reproduce the issue with a minimalistic app.Robert Jaros
09/15/2024, 6:06 PMOrfeo Ciano
09/15/2024, 6:07 PMOrfeo Ciano
09/15/2024, 6:18 PMOrfeo Ciano
09/15/2024, 6:19 PMRobert Jaros
09/15/2024, 6:37 PM