Consider adding gzip or brotli compression for Draco and Basis WASM binaries

I noticed in a recent project that the Draco and Basis Universal WASM libraries are served by default from the domain. For example:

Given the term “preview” appears in the domain … is it considered acceptable to use those defaults for production applications, or would that be discouraged? If that usage is OK, it’d be a helpful bundle size improvement if these resources could be compressed by default (gzip, brotli). With some static hosting providers that’s a simple setting to enable, with others it might be more complex. In the case of the Basis transcoder that’s a 450kb → 220kb improvement. Thanks!

EDIT: Perhaps a partial answer to my own question here, the Basis and Draco libraries do change over time, so I suppose an unversioned URL is not the greatest idea for production use. If there’s a versioned alternative to the URLs above I’d be interested to know – and in that case the same Gzip/Brotli question would apply.

1 Like

Seems that for production version there are

1 Like

Thanks – these versions are gzipped so that looks much better!

1 Like

Ended up with this configuration —

import { KhronosTextureContainer2 } from "@babylonjs/core/Misc/khronosTextureContainer2";
import { DracoCompression } from "@babylonjs/core/Meshes/Compression/dracoCompression";

// Production CDN uses gzip, while the default 'preview' CDN does not.
DracoCompression.Configuration.decoder.wasmUrl = "";
DracoCompression.Configuration.decoder.wasmBinaryUrl = "";
DracoCompression.Configuration.decoder.fallbackUrl = "";

KhronosTextureContainer2.URLConfig.jsDecoderModule = "";
KhronosTextureContainer2.URLConfig.jsMSCTranscoder = "" as any;
KhronosTextureContainer2.URLConfig.wasmMSCTranscoder = "" as any;


Hey Don!

Yes we consider the preview as our current version. But you already found the cdn version which is great for your needs

So all good :wink:

1 Like

I added application/wasm to the list of files being compressed on our preview CDN. it should propagate soon. Might be after the next full purge (i.e. next nightly)