Hi. Is it possible to deploy Kotlin/Wasm anywhere ...
# webassembly
a
Hi. Is it possible to deploy Kotlin/Wasm anywhere yet?
b
Only to chrome and even then you need to sign up for wasm gc origin trials. All other deployment targets need custom flags enabled on consumer end
a
I do run it in Chrome already with the GC flag enabled, and works great, but i wondered it i can deploy it somewhere for example GCP?
b
Sure, it's just a bundle of static files like any other web app afterall.
a
is the approach the same like deploying Kotlin/js app?
b
My point is that any consumer if your app will need flags enabled.
Approach is exactly the same like deploying any static web app
You can deploy it to gh pages if you want an easy and free option
a
Really? Will the wasm still work?
b
Sure, hosting solution has nothing to do with js nor wasm. All you need is just something to serve a bunch of static files to the browser
Gh pages is one of such "somethings"
a
do i point it to
build/dist/wasm/productionExecutable
? After running
wasmBrowserProductionWebpack
CleanShot 2023-07-01 at 16.28.19@2x.png
m
You can use netlify as well, just drag and drop that folder containing your executable files and it will work
a
hmmm if i open
index.html
in the
productionExecutable
it only opens index, but wasm is not running. The console complains about missing: •
wasmapp.uninstantiated.mjs
favicon.ico
The favico itself does not exist at all in the project so had to get it from different repo. The
wasmapp.uninstantiated.mjs
is located in
Copy code
$buildDir/compileSync/wasm/main/productionExecutable/kotlin/wasmapp.uninstantiated.mjs
So had to create tasks to copy them into the same dir after
wasmBrowserProductionWebpack
is finished. May be using wasm with GH Pages for now so copying it all in the
rootDir/docs
. This time app runs when i launch it from the
index.html
locally 👏 Will try deployment next. 🤞
It looks like the
wasmBrowserProductionWebpack
task could do with improving so it copies all needed files into one dir.
@Big Chungus Thanks for pushing me in the right direction.
b
Happy to help
a
GH Pages works like a dream 😉
❤️ 1
🚀 1