+precompress
The +precompress setting creates .br and .gz files for your static assets at build time, so that they don't have to be compressed on each request.
// pages/+config.js
export default {
precompress: true
}// pages/+config.ts
import type { Config } from 'vike/types'
export default {
precompress: true
} satisfies Configdist/client/assets/chunks/chunk-C7ohsKGx.js
dist/client/assets/chunks/chunk-C7ohsKGx.js.br
dist/client/assets/chunks/chunk-C7ohsKGx.js.gzThe
+precompresssetting is usually used when self-hosting — with most managed hosting platforms (Cloudflare, Vercel, Netlify, ...), you don't need+precompress: static assets are compressed by the platform.
Small files, and files that are already compressed (such as
.png,.jpgand.woff2), don't get.br/.gzfiles.
Serving
If you use +server, the .br/.gz files are served automatically.
If you use your own server, make sure your server serves them. For example with sirv:
sirv('dist/client', { brotli: true, gzip: true })Likewise, if you use
+serverwithprod.staticset tofalse, then make sure your static server serves the.br/.gzfiles.
public/
Files in public/ are copied as-is and don't get .br/.gz files. If you add your own .br/.gz, they're served, but keeping them up-to-date is up to you.