Why is this dependency on `skiko` required in `co...
# compose-web
r
Why is this dependency on
skiko
required in
compose.components.resources
for
js
or
wasmJs
targets? https://github.com/JetBrains/compose-multiplatform/blob/master/components/resources/library/build.gradle.kts#L61 I don't draw on canvas, don't want
skiko.wasm
loaded. I just would like to use
Res
and easily read resources in my
common
sources set.
k
there is no a resources library for KMP 😉 only for Compose Multiplatform
r
I'm definitely using Compose Multiplatform, just not compose-web (canvas) 🙂
I've filled a similar issue regarding compose-animations, but at least I understand why is the skiko dependency used there (https://github.com/JetBrains/compose-multiplatform/issues/4133). But I'm not sure why it's needed for resources library.
o
Yeah, it's similar to the issue with compose-animations. The resources library depends on compose-foundation which depends on compose-ui -> skiko. If you use only limited set of API - not involving compose-ui and skiko, then the release distribution will likely work too. Not sure that it can be easily solved for dev builds, because DCE is not enabed there. What APIs do you want to use from the resources lib? What Res do you want to have?
r
I'd like to use
files
(
Res.readBytes
) and
values/strings.xml
.
Res.readBytes
works fine without skiko on both js and wasm (production)
👍 1
r
But values/strings.xml crashes my wasm app
Copy code
Uncaught (in promise) TypeError: e is undefined
    stringLength
when I use
getString(Res.string.app_name)
I see this exception
when I use
getString(Res.string.app_name).toJsString()
the browser tab crashes
o
On a first glance, that call doesn't involve skiko (imo it shouldn't). Anyway wondering if including skiko into the distribution would make any difference
r
let me check
No, it still doesn't work. The same error in dev and prod.
I've used the
strings.xml
file from the demo project.
The
Res
seem to be generated correctly and it works fine with js target.
o
Could you please submit it to the issue tracker with your reproducer?
r
I can't prepare a reproducer because I haven't released any artifacts of my library yet. I can only point you to my project repo and gradle tasks to run the example app. Would that be enough?
o
Good. Thanks
r
And returning to the skiko issue, could you consider extracting some core functionality, like files and strings, which could be really useful for all compose apps, even those not using any graphics, to be usable without foundation, ui and skiko?
o
We didn't consider this use case. @Konstantin Tskhovrebov what do you think? Can we consider making a "core resources lib" without a dependency on foundation? And an extended lib which depends as api() on the "core" (so by default an extend lib will expose the core api too)
235 Views