Production build with Vite

Not really an issue with Phaser3 per se, but perhaps someone can point me in the right direction.

After deploying the “dist” folder (bundled with Vite + Phaser template) to a web server, I am having problems with the browser using cached code despite deploying new versions.

I made a small change to some javascript source code and vite still creates (in dist/assets) a file that always has the same names (index-bxR99R7y.js and phaser-w40geAFS.js). I would have expected at least the index-*.js file to have a different name if I rebuild after modifying a javascript source file.

I spent the last 24 hours researching etags, Vite configuration, various “cache busting” techniques such as appending a unique query string to the URL that loaded my boot scene in index.html, but nothing seems to work reliably except running my game in an “incognito” session.

Appending a random query string to one of my images (the URL string passed to this.load.image) did work for that partiuclar image (which has been changing frequently during development), but I need a solution for code changes as well. Unless I ask all the people who play my game to reload with Shift-F5 or run “incognito” mode :wink:

Any help would be appreciated!

That’s odd. Vite should do that correctly for the bundle scripts without any extra configuration. Although if you put static files in the public folder they won’t be hashed, I guess.

Have you emptied the dist folder and then repeated npm run build or similar?