https://kotlinlang.org logo
#webassembly
Title
# webassembly
a

aishwaryabhishek3

11/24/2023, 10:00 AM
Hi , I was trying to run the peopleInSpace sample with compose web wasm : https://github.com/joreilly/PeopleInSpace , It all works fine if I run
wasmJsBrowserRun
but if I run
wasmJsBrowserDistribution
and try to open the index.html locally in browser it does not work . Any help appreciated
Gives me bunch of errors if i open locally :
b

bashor

11/24/2023, 10:19 AM
try to serve static files from the dir with any http server, e.g.
python -m http.server
a

aishwaryabhishek3

11/24/2023, 10:20 AM
So these html files will only work if a server serves them ? Is this a requirement from wasm side ? (completely noob in web development here so excuse me If i sound stupid 😄 )
b

bashor

11/24/2023, 10:24 AM
there is restriction for
file://
protocol
🙌 1
a

aishwaryabhishek3

11/24/2023, 10:29 AM
Thanks , one last thing , When I publish the distribution folder on netlify : https://joyful-sawine-0e1c45.netlify.app/. It gives error in console . All my other sites created on wasm target work fine . The file that it says is missing is not even there in my dist folder (
PeopleInSpace.uninstantiated.mjs:1
) . Any idea how I would go about debugging this as it works fine when I do
wasmJsBrowserRun
b

bashor

11/24/2023, 10:32 AM
what is version of kotlin there?
a

aishwaryabhishek3

11/24/2023, 10:33 AM
Copy code
1.9.20
b

bashor

11/24/2023, 12:38 PM
Probably index.html outdated and
<script type="module" src="load.mjs"></script>
should be replaced with
<script type="application/javascript" src="???.js"></script>
???.js
should be replaced with proper js file name from dist folder
a

aishwaryabhishek3

11/24/2023, 12:39 PM
load.mjs
is the correct file name
Let me try building again and re uploading
b

bashor

11/24/2023, 12:44 PM
we no longer load it directly in our examples, for example, look at here
cc @John O'Reilly
j

John O'Reilly

11/24/2023, 12:52 PM
Ah, I think I updated other samples to reflect that change but not this one
🙌 1
🙏 1
@bashor in https://github.com/Kotlin/kotlin-wasm-examples/blob/main/compose-jetsnack/web/webpack.config.d/boilerplate.js you're loading
load.mjs
which in turn is trying to load
./jetsnackwasmapp.uninstantiated.mjs
which I don't see generated.....but doesn't seem to be an issue for that project for some reason.
whereas I'm getting following with what seems like same changes for peopleinspace (though I must be something differently)
Copy code
GET <http://localhost:8000/peopleinspace.uninstantiated.mjs> net::ERR_ABORTED 404 (File not found)
k, nvm, I had missed one update....does seem like
load.mjs
is redundant now (and maybe it's reference in
boilerplate.js
? Can they be removed?
@aishwaryabhishek3 that's merged now
🙌 1
also updated chip-8 and bikeshare repos to more closely align with approach used
b

bashor

11/27/2023, 3:48 PM
load.mjs
is still needed, but we are working on making compose projects without custom loaders.
In our examples
load.mjs
was simplified recently by extracting handling WebAssembly.CompileError to the html file, look at f4f39b
3 Views