When we run the compose web app with `wasmJsBrowse...
# compose-web
d
When we run the compose web app with
wasmJsBrowserDevelopmentRun
, it start on port 8080. After that, if we make any change to the code, I noticed that app is not updated. So is there any way using which we can re run the app when we change the code? My current app takes around 4 seconds to re run using above command. It is getting very frustrated to wait each time I make a small change to UI. I tried using continuous mode of Gradle, but still it try to run
compileDevelopmentExecutableKotlinWasmJs
which takes significant amount of time to complete. Can anyone share any info on this?
r
do you use
-t
flag ?
In general wasm compilation takes longer than js. You can try developing with JS target and building with wasmJS for production.
r
do you have any doc explaining this flag?
r
-t
is continuous mode so my question was too hasty (op already answered that)
r
👍
d
@Robert Jaros Sorry but I am not able to understand this. https://kotlinlang.slack.com/archives/C01F2HV7868/p1758725405910149?thread_ts=1758725217.106119&cid=C01F2HV7868 How can I use JS target along with wasmJs? As much as I understand Compose Multiplatform code works with wasm. So can you share how can it run on JS target? If you have any blog or link it would be great to understand this.
r
Meant that you could use js target instead wasm while developing, and use wams only for production environment. Not sure if is a valid change for you but that will speed up ur development
d
So for business logic, I can develop with JS target. But, for compose multiplatform is it possible to develop with JS target? I am confused in that part.
r
Compose can work with js target as well
It's just a lot slower at runtime
But faster at compile time, so can be a good choice for development.
If you want an example you can generate a simple web project with kmp wizard at https://kmp.jetbrains.com. It will use both
wasmJs
and
Js
targets and shared
webMain
sources set with application sources.
d
Wow!! I did not know that. I was under impression that to run compose multiplatform on web, we must use wasm. After reading code from jetbrains sample and modifying my existing project, I am able to run the app using wasm and js both. Thank you @Robert Jaros for helping promptly! 🙌