Question in regards to versioning with WasmJs targ...
# multiplatform
s
Question in regards to versioning with WasmJs targets. Currently I've noticed that when I create new builds using
wasmJsBrowserDistribution
and deploy these online, the fixes or new versions aren't visible inside of the browser because the
wasm
files get cached by the browser. Is there a standard mechanism available to ensure that the output builds either get versioned inside of the distribution step, or that the browser always picks up the latest version? Currently I've picked up the strategy to version the actual modulename & output (and keep this in sync with the HTML file), but there should be a better approach I assume.
👀 1
w
I thought this was what the hash-looking names of the files was supposed to solve. Every time I deploy new code I get a different set of names for the .wasm files.
s
Maybe that was the intention, but our observations were different I'm afraid. Which is why I'm asking 😅
w
Are you renaming the main file somehow? From https://youtrack.jetbrains.com/issue/KT-73907/Wasm-Duplication-of-files-in-browser-distribution It seems to imply that the name is indeed a content hash and would bust the browser cache.
s
So were setting the
outputFileName
in the
browser
block indeed, but even when I remove this, it seems that the hash-named
wasm
file stays the same. The pics in attachment show the dist folder, once as-is and the second time when I add an additional composable to the layout, the output hash/name stays the same.
w
Huh, that is weird, and probably a bug. Does it change if you clean and then rebuild? Maybe some weird cached output issue similar to that YouTrack issue.
🤷‍♂️ 1
s
This were the results of executing
./gradlew clean wasmJsBrowserDistribution
. I'll try running them individually to see if that makes a difference but I assume that it shouldn't.
w
Yeah, it shouldn't. Weird.
I assume that composable you changed is actually called in production? Otherwise the minifier might've stripped it from the final binary.
s
It was definitely inside of a composable that gets rendered yeah. I'll look at bit further into it then, thanks for the help anyway!
w
If you figure it out, please do share. I'm about to get into caching with my web app and knowing what's going on here would be really helpful. 🙏
s
WIll definitely do 👍