Hi everyone, I'm working on a KMP project with Kot...
# multiplatform
m
Hi everyone, I'm working on a KMP project with Kotlin/Wasm, and I was wondering if there is a way to bundle the output in one HTML file. I mean here the
index.html
, the js laoder, and the wasm file. I'm wondering if there are any ready-made solutions or plugins for this? I'd appreciate any help
a
Wasm is a binary format, perhaps you can embedded the bytes directly in to the html, but at this point, I'd have to ask, why do you need to do such a thing?
o
When you build a wasm project it generate an index.html file as an entrypoint. Or I don't understand what you mean
m
It's for interactive/playable ads; we have our game written in KMP and want to create a playable ad using the same code.
You get two options to package everything in one HTML file or upload a zip file containing scripts + resources. But there are some restrictions on the file's location; assets need to be under /assets. We're not sure if the wasm binaries will be considered assets or no. Also, they recommend having everything URI-encoded within the scripts
Also, there is a restriction on the uploaded sizes and the output index.html and the loader js easily exceeding the limits, so it's one more complication.