Skip to content

@modoki/engine / index / withCacheBust

Function: withCacheBust() ​

withCacheBust(url, hash?): string

Append the content-hash cache-bust query ?v=<hash> to a resolved URL, but ONLY in production builds and ONLY when a hash is known — a re-import mints a new hash → a new URL the browser/CDN hasn't cached. Dev + the packaged editor serve through the Vite dev server (no immutable caching, HMR), so it's a no-op there. Query-aware (& when the URL already has a ?). Single source of truth for BOTH the model (modelGlbUrl) and texture (resolveTextureVariantUrl) appenders so the scheme can never drift between them. (B4)

Parameters ​

url ​

string

hash? ​

string

Returns ​

string

Built with Modoki.