Cache-Busting with solid.js

I have a CSR SPA, where the contents sit in static webstorage and the solid.js site is rendered on the client side. E.g.:
export default defineConfig({
  ssr: false,
  server: {
    static: true,
    preset: "static"
  },


My CI will build the site when changes are made to the
main
branch, and replace the contents of the S3 folder.
When that happens I also invalidate the cloudfront-cache, so all future requests go at least once to the newly update files and aren't served by cloudfront.

BUT: There also seems to be some browser-caching going on, i.e. sometimes, after an update of my site, if I switch to a tab I had open of the solid-js SPA, I will get an
unknown client error
and some import problem of the
_build/assets/filename-CRYkDoFJ.js
where it tries to load one of the old
***-<id>.js
build artifacts.
Do any of you have experience preventing this?
(I don't want my users to have to refresh their browsers if they have our site open in a tab and happen to come back to it after a few days away)
Was this page helpful?